diff options
| author | Christian Poessinger <christian@poessinger.com> | 2022-04-15 21:57:03 +0200 | 
|---|---|---|
| committer | Christian Poessinger <christian@poessinger.com> | 2022-04-15 21:57:03 +0200 | 
| commit | abfe42d11137373f6549d17e69618840d574e524 (patch) | |
| tree | 429a9520d54977a8dd307005be122b0b4b91ee14 | |
| parent | c2b54ed6d1dc49a908e77d5fd96a2f4e2e01f887 (diff) | |
| download | vyos-1x-abfe42d11137373f6549d17e69618840d574e524.tar.gz vyos-1x-abfe42d11137373f6549d17e69618840d574e524.zip | |
dhcp(v6)-server: T4353: fix Jinja2 linting errors
| -rw-r--r-- | data/templates/dhcp-server/dhcpd.conf.j2 (renamed from data/templates/dhcp-server/dhcpd.conf.tmpl) | 218 | ||||
| -rw-r--r-- | data/templates/dhcp-server/dhcpdv6.conf.j2 | 124 | ||||
| -rw-r--r-- | data/templates/dhcp-server/dhcpdv6.conf.tmpl | 124 | ||||
| -rwxr-xr-x | src/conf_mode/dhcp_server.py | 4 | ||||
| -rwxr-xr-x | src/conf_mode/dhcpv6_server.py | 2 | 
5 files changed, 236 insertions, 236 deletions
| diff --git a/data/templates/dhcp-server/dhcpd.conf.tmpl b/data/templates/dhcp-server/dhcpd.conf.j2 index efc144a1e..40575cea2 100644 --- a/data/templates/dhcp-server/dhcpd.conf.tmpl +++ b/data/templates/dhcp-server/dhcpd.conf.j2 @@ -26,21 +26,21 @@ option wpad-url code 252 = text;  {% if global_parameters is vyos_defined %}  # The following {{ global_parameters | length }} line(s) have been added as  # global-parameters in the CLI and have not been validated !!! -{%   for parameter in global_parameters %} +{%     for parameter in global_parameters %}  {{ parameter }} -{%   endfor %} +{%     endfor %}  {% endif %}  {% if failover is vyos_defined %}  # DHCP failover configuration  failover peer "{{ failover.name }}" { -{%   if failover.status == 'primary' %} +{%     if failover.status == 'primary' %}      primary;      mclt 1800;      split 128; -{%   elif failover.status == 'secondary' %} +{%     elif failover.status == 'secondary' %}      secondary; -{%   endif %} +{%     endif %}      address {{ failover.source_address }};      port 647;      peer address {{ failover.remote }}; @@ -53,170 +53,170 @@ failover peer "{{ failover.name }}" {  {% if listen_address is vyos_defined %}  # DHCP server serving relay subnet, we need a connector to the real world -{%   for address in listen_address %} +{%     for address in listen_address %}  # Connected subnet statement for listen-address {{ address }}  subnet {{ address | network_from_ipv4 }} netmask {{ address | netmask_from_ipv4 }} { } -{%   endfor %} +{%     endfor %}  {% endif %}  # Shared network configration(s)  {% if shared_network_name is vyos_defined %} -{%   for network, network_config in shared_network_name.items() if network_config.disable is not vyos_defined %} +{%     for network, network_config in shared_network_name.items() if network_config.disable is not vyos_defined %}  shared-network {{ network }} { -{%     if network_config.authoritative is vyos_defined %} +{%         if network_config.authoritative is vyos_defined %}      authoritative; -{%     endif %} -{%     if network_config.name_server is vyos_defined %} +{%         endif %} +{%         if network_config.name_server is vyos_defined %}      option domain-name-servers {{ network_config.name_server | join(', ') }}; -{%     endif %} -{%     if network_config.domain_name is vyos_defined %} +{%         endif %} +{%         if network_config.domain_name is vyos_defined %}      option domain-name "{{ network_config.domain_name }}"; -{%     endif %} -{%     if network_config.domain_search is vyos_defined %} +{%         endif %} +{%         if network_config.domain_search is vyos_defined %}      option domain-search "{{ network_config.domain_search | join('", "') }}"; -{%     endif %} -{%     if network_config.ntp_server is vyos_defined %} +{%         endif %} +{%         if network_config.ntp_server is vyos_defined %}      option ntp-servers {{ network_config.ntp_server | join(', ') }}; -{%     endif %} -{%     if network_config.ping_check is vyos_defined %} +{%         endif %} +{%         if network_config.ping_check is vyos_defined %}      ping-check true; -{%     endif %} -{%     if network_config.shared_network_parameters is vyos_defined %} +{%         endif %} +{%         if network_config.shared_network_parameters is vyos_defined %}      # The following {{ network_config.shared_network_parameters | length }} line(s)      # were added as shared-network-parameters in the CLI and have not been validated -{%       for parameter in network_config.shared_network_parameters %} +{%             for parameter in network_config.shared_network_parameters %}      {{ parameter }} -{%       endfor %} -{%     endif %} -{%     if network_config.subnet is vyos_defined %} -{%       for subnet, subnet_config in network_config.subnet.items() %} -{%         if subnet_config.description is vyos_defined %} -    # {{ subnet_config.description }} +{%             endfor %}  {%         endif %} +{%         if network_config.subnet is vyos_defined %} +{%             for subnet, subnet_config in network_config.subnet.items() %} +{%                 if subnet_config.description is vyos_defined %} +    # {{ subnet_config.description }} +{%                 endif %}      subnet {{ subnet | address_from_cidr }} netmask {{ subnet | netmask_from_cidr }} { -{%         if subnet_config.name_server is vyos_defined %} +{%                 if subnet_config.name_server is vyos_defined %}          option domain-name-servers {{ subnet_config.name_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.domain_name is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.domain_name is vyos_defined %}          option domain-name "{{ subnet_config.domain_name }}"; -{%         endif %} -{%         if subnet_config.domain_search is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.domain_search is vyos_defined %}          option domain-search "{{ subnet_config.domain_search | join('", "') }}"; -{%         endif %} -{%         if subnet_config.ntp_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.ntp_server is vyos_defined %}          option ntp-servers {{ subnet_config.ntp_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.pop_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.pop_server is vyos_defined %}          option pop-server {{ subnet_config.pop_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.smtp_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.smtp_server is vyos_defined %}          option smtp-server {{ subnet_config.smtp_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.time_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.time_server is vyos_defined %}          option time-servers {{ subnet_config.time_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.wins_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.wins_server is vyos_defined %}          option netbios-name-servers {{ subnet_config.wins_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.static_route is vyos_defined %} -{%           set static_default_route = '' %} -{%           if subnet_config.default_router is vyos_defined %} -{%             set static_default_route = ', ' ~ '0.0.0.0/0' | isc_static_route(subnet_config.default_router) %} -{%           endif %} -{%           if subnet_config.static_route is vyos_defined %} -{%           set rfc3442_routes = [] %} -{%           for route, route_options in subnet_config.static_route.items() %} -{%             set rfc3442_routes = rfc3442_routes.append(route | isc_static_route(route_options.next_hop)) %} -{%           endfor %} +{%                 endif %} +{%                 if subnet_config.static_route is vyos_defined %} +{%                     set static_default_route = '' %} +{%                     if subnet_config.default_router is vyos_defined %} +{%                         set static_default_route = ', ' ~ '0.0.0.0/0' | isc_static_route(subnet_config.default_router) %} +{%                     endif %} +{%                     if subnet_config.static_route is vyos_defined %} +{%                         set rfc3442_routes = [] %} +{%                         for route, route_options in subnet_config.static_route.items() %} +{%                             set rfc3442_routes = rfc3442_routes.append(route | isc_static_route(route_options.next_hop)) %} +{%                         endfor %}          option rfc3442-static-route {{ rfc3442_routes | join(', ') }}{{ static_default_route }};          option windows-static-route {{ rfc3442_routes | join(', ') }}; -{%           endif %} -{%         endif %} -{%         if subnet_config.ip_forwarding is vyos_defined %} +{%                     endif %} +{%                 endif %} +{%                 if subnet_config.ip_forwarding is vyos_defined %}          option ip-forwarding true; -{%         endif %} -{%         if subnet_config.default_router is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.default_router is vyos_defined %}          option routers {{ subnet_config.default_router }}; -{%         endif %} -{%         if subnet_config.server_identifier is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.server_identifier is vyos_defined %}          option dhcp-server-identifier {{ subnet_config.server_identifier }}; -{%         endif %} -{%         if subnet_config.subnet_parameters is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.subnet_parameters is vyos_defined %}          # The following {{ subnet_config.subnet_parameters | length }} line(s) were added as          # subnet-parameters in the CLI and have not been validated!!! -{%           for parameter in subnet_config.subnet_parameters %} +{%                     for parameter in subnet_config.subnet_parameters %}          {{ parameter }} -{%           endfor %} -{%         endif %} -{%         if subnet_config.tftp_server_name is vyos_defined %} +{%                     endfor %} +{%                 endif %} +{%                 if subnet_config.tftp_server_name is vyos_defined %}          option tftp-server-name "{{ subnet_config.tftp_server_name }}"; -{%         endif %} -{%         if subnet_config.bootfile_name is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.bootfile_name is vyos_defined %}          option bootfile-name "{{ subnet_config.bootfile_name }}";          filename "{{ subnet_config.bootfile_name }}"; -{%         endif %} -{%         if subnet_config.bootfile_server is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.bootfile_server is vyos_defined %}          next-server {{ subnet_config.bootfile_server }}; -{%         endif %} -{%         if subnet_config.bootfile_size is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.bootfile_size is vyos_defined %}          option boot-size {{ subnet_config.bootfile_size }}; -{%         endif %} -{%         if subnet_config.time_offset is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.time_offset is vyos_defined %}          option time-offset {{ subnet_config.time_offset }}; -{%         endif %} -{%         if subnet_config.wpad_url is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.wpad_url is vyos_defined %}          option wpad-url "{{ subnet_config.wpad_url }}"; -{%         endif %} -{%         if subnet_config.client_prefix_length is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.client_prefix_length is vyos_defined %}          option subnet-mask {{ ('0.0.0.0/' ~ subnet_config.client_prefix_length) | netmask_from_cidr }}; -{%         endif %} -{%         if subnet_config.lease is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.lease is vyos_defined %}          default-lease-time {{ subnet_config.lease }};          max-lease-time {{ subnet_config.lease }}; -{%         endif %} -{%         if network_config.ping_check is not vyos_defined and subnet_config.ping_check is vyos_defined %} +{%                 endif %} +{%                 if network_config.ping_check is not vyos_defined and subnet_config.ping_check is vyos_defined %}          ping-check true; -{%         endif %} -{%         if subnet_config.static_mapping is vyos_defined %} -{%           for host, host_config in subnet_config.static_mapping.items() if host_config.disable is not vyos_defined %} +{%                 endif %} +{%                 if subnet_config.static_mapping is vyos_defined %} +{%                     for host, host_config in subnet_config.static_mapping.items() if host_config.disable is not vyos_defined %}          host {{ host | replace('_','-') if host_decl_name is vyos_defined else network | replace('_','-') ~ '_' ~ host | replace('_','-') }} { -{%             if host_config.ip_address is vyos_defined %} +{%                         if host_config.ip_address is vyos_defined %}              fixed-address {{ host_config.ip_address }}; -{%             endif %} +{%                         endif %}              hardware ethernet {{ host_config.mac_address }}; -{%             if host_config.static_mapping_parameters is vyos_defined %} +{%                         if host_config.static_mapping_parameters is vyos_defined %}              # The following {{ host_config.static_mapping_parameters | length }} line(s) were added              # as static-mapping-parameters in the CLI and have not been validated -{%               for parameter in host_config.static_mapping_parameters %} +{%                             for parameter in host_config.static_mapping_parameters %}              {{ parameter }} -{%               endfor %} -{%             endif %} +{%                             endfor %} +{%                         endif %}          } -{%           endfor %} -{%         endif %} -{%         if subnet_config.range is vyos_defined %} +{%                     endfor %} +{%                 endif %} +{%                 if subnet_config.range is vyos_defined %}  {#           pool configuration can only be used if there follows a range option #}          pool { -{%         endif %} -{%         if subnet_config.enable_failover is vyos_defined %} +{%                 endif %} +{%                 if subnet_config.enable_failover is vyos_defined %}              failover peer "{{ failover.name }}";              deny dynamic bootp clients; -{%         endif %} -{%           if subnet_config.range is vyos_defined %} -{%             for range, range_options in subnet_config.range.items() %} +{%                 endif %} +{%                 if subnet_config.range is vyos_defined %} +{%                     for range, range_options in subnet_config.range.items() %}              range {{ range_options.start }} {{ range_options.stop }}; -{%             endfor %} -{%           endif %} -{%         if subnet_config.range is vyos_defined %} +{%                     endfor %} +{%                 endif %} +{%                 if subnet_config.range is vyos_defined %}  {#           pool configuration can only be used if there follows a range option #}          } -{%         endif %} +{%                 endif %}      } -{%       endfor %} -{%     endif %} +{%             endfor %} +{%         endif %}      on commit {          set shared-networkname = "{{ network }}"; -{%     if hostfile_update is vyos_defined %} +{%         if hostfile_update is vyos_defined %}          set ClientIp = binary-to-ascii(10, 8, ".", leased-address);          set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));          set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname"); @@ -226,9 +226,9 @@ shared-network {{ network }} {          } else {              log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));          } -{%     endif %} +{%         endif %}      }  } -{%   endfor %} +{%     endfor %}  {% endif %} diff --git a/data/templates/dhcp-server/dhcpdv6.conf.j2 b/data/templates/dhcp-server/dhcpdv6.conf.j2 new file mode 100644 index 000000000..284b7f269 --- /dev/null +++ b/data/templates/dhcp-server/dhcpdv6.conf.j2 @@ -0,0 +1,124 @@ +### Autogenerated by dhcpv6_server.py ### + +# For options please consult the following website: +# https://www.isc.org/wp-content/uploads/2017/08/dhcp43options.html + +log-facility local7; +{% if preference is vyos_defined %} +option dhcp6.preference {{ preference }}; +{% endif %} + +{% if global_parameters.name_server is vyos_defined %} +option dhcp6.name-servers {{ global_parameters.name_server | join(', ') }}; +{% endif %} + +# Shared network configration(s) +{% if shared_network_name is vyos_defined %} +{%     for network, network_config in shared_network_name.items() if network_config.disable is not vyos_defined %} +shared-network {{ network }} { +{%         if network_config.common_options is vyos_defined %} +{%             if network_config.common_options.info_refresh_time is vyos_defined %} +    option dhcp6.info-refresh-time {{ network_config.common_options.info_refresh_time }}; +{%             endif %} +{%             if network_config.common_options.domain_search is vyos_defined %} +    option dhcp6.domain-search "{{ network_config.common_options.domain_search | join('", "') }}"; +{%             endif %} +{%             if network_config.common_options.name_server is vyos_defined %} +    option dhcp6.name-servers {{ network_config.common_options.name_server | join(', ') }}; +{%             endif %} +{%         endif %} +{%         if network_config.subnet is vyos_defined %} +{%             for subnet, subnet_config in network_config.subnet.items() %} +    subnet6 {{ subnet }} { +{%                 if subnet_config.address_range is vyos_defined %} +{%                     if subnet_config.address_range.prefix is vyos_defined %} +{%                         for prefix, prefix_config in subnet_config.address_range.prefix.items() %} +        range6 {{ prefix }} {{ "temporary" if prefix_config.temporary is vyos_defined }}; +{%                         endfor %} +{%                     endif %} +{%                     if subnet_config.address_range.start is vyos_defined %} +{%                         for address, address_config in subnet_config.address_range.start.items() %} +        range6 {{ address }} {{ address_config.stop }}; +{%                         endfor %} +{%                     endif %} +{%                 endif %} +{%                 if subnet_config.domain_search is vyos_defined %} +        option dhcp6.domain-search "{{ subnet_config.domain_search | join('", "') }}"; +{%                 endif %} +{%                 if subnet_config.lease_time is vyos_defined %} +{%                     if subnet_config.lease_time.default is vyos_defined %} +        default-lease-time {{ subnet_config.lease_time.default }}; +{%                     endif %} +{%                     if subnet_config.lease_time.maximum is vyos_defined %} +        max-lease-time {{ subnet_config.lease_time.maximum }}; +{%                     endif %} +{%                     if subnet_config.lease_time.minimum is vyos_defined %} +        min-lease-time {{ subnet_config.lease_time.minimum }}; +{%                     endif %} +{%                 endif %} +{%                 if subnet_config.name_server is vyos_defined %} +        option dhcp6.name-servers {{ subnet_config.name_server | join(', ') }}; +{%                 endif %} +{%                 if subnet_config.nis_domain is vyos_defined %} +        option dhcp6.nis-domain-name "{{ subnet_config.nis_domain }}"; +{%                 endif %} +{%                 if subnet_config.nis_server is vyos_defined %} +        option dhcp6.nis-servers {{ subnet_config.nis_server | join(', ') }}; +{%                 endif %} +{%                 if subnet_config.nisplus_domain is vyos_defined %} +        option dhcp6.nisp-domain-name "{{ subnet_config.nisplus_domain }}"; +{%                 endif %} +{%                 if subnet_config.nisplus_server is vyos_defined %} +        option dhcp6.nisp-servers {{ subnet_config.nisplus_server | join(', ') }}; +{%                 endif %} +{%                 if subnet_config.sip_server is vyos_defined %} +{%                     set server_ip = [] %} +{%                     set server_fqdn = [] %} +{%                     for address in subnet_config.sip_server %} +{%                         if address | is_ipv6 %} +{%                             set server_ip = server_ip.append(address) %} +{%                         else %} +{%                             set server_fqdn = server_fqdn.append(address) %} +{%                         endif %} +{%                     endfor %} +{%                     if server_ip is vyos_defined and server_ip | length > 0 %} +        option dhcp6.sip-servers-addresses {{ server_ip | join(', ') }}; +{%                     endif %} +{%                     if server_fqdn is vyos_defined and server_fqdn | length > 0 %} +        option dhcp6.sip-servers-names "{{ server_fqdn | join('", "') }}"; +{%                     endif %} +{%                 endif %} +{%                 if subnet_config.sntp_server is vyos_defined %} +        option dhcp6.sntp-servers {{ subnet_config.sntp_server | join(', ') }}; +{%                 endif %} +{%                 if subnet_config.prefix_delegation.start is vyos_defined %} +{%                     for prefix, prefix_config in subnet_config.prefix_delegation.start.items() %} +        prefix6 {{ prefix }} {{ prefix_config.stop }} /{{ prefix_config.prefix_length }}; +{%                     endfor %} +{%                 endif %} +{%                 if subnet_config.static_mapping is vyos_defined %} + +        # begin configuration of static client mappings +{%                     for host, host_config in subnet_config.static_mapping.items() if host_config.disable is not vyos_defined %} +        host {{ network | replace('_','-') }}_{{ host | replace('_','-') }} { +{%                         if host_config.identifier is vyos_defined %} +            host-identifier option dhcp6.client-id {{ host_config.identifier }}; +{%                         endif %} +{%                         if host_config.ipv6_address is vyos_defined %} +            fixed-address6 {{ host_config.ipv6_address }}; +{%                         endif %} +{%                         if host_config.ipv6_prefix is vyos_defined %} +            fixed-prefix6 {{ host_config.ipv6_prefix }}; +{%                         endif %} +        } +{%                     endfor %} +{%                 endif %} +    } +{%             endfor %} +{%         endif %} +    on commit { +        set shared-networkname = "{{ network }}"; +    } +} +{%     endfor %} +{% endif %} diff --git a/data/templates/dhcp-server/dhcpdv6.conf.tmpl b/data/templates/dhcp-server/dhcpdv6.conf.tmpl deleted file mode 100644 index 1a55668e1..000000000 --- a/data/templates/dhcp-server/dhcpdv6.conf.tmpl +++ /dev/null @@ -1,124 +0,0 @@ -### Autogenerated by dhcpv6_server.py ### - -# For options please consult the following website: -# https://www.isc.org/wp-content/uploads/2017/08/dhcp43options.html - -log-facility local7; -{% if preference is vyos_defined %} -option dhcp6.preference {{ preference }}; -{% endif %} - -{% if global_parameters.name_server is vyos_defined %} -option dhcp6.name-servers {{ global_parameters.name_server | join(', ') }}; -{% endif %} - -# Shared network configration(s) -{% if shared_network_name is vyos_defined %} -{%   for network, network_config in shared_network_name.items() if network_config.disable is not vyos_defined %} -shared-network {{ network }} { -{%     if network_config.common_options is vyos_defined %} -{%       if network_config.common_options.info_refresh_time is vyos_defined %} -    option dhcp6.info-refresh-time {{ network_config.common_options.info_refresh_time }}; -{%       endif %} -{%       if network_config.common_options.domain_search is vyos_defined %} -    option dhcp6.domain-search "{{ network_config.common_options.domain_search | join('", "') }}"; -{%       endif %} -{%       if network_config.common_options.name_server is vyos_defined %} -    option dhcp6.name-servers {{ network_config.common_options.name_server | join(', ') }}; -{%       endif %} -{%     endif %} -{%     if network_config.subnet is vyos_defined %} -{%       for subnet, subnet_config in network_config.subnet.items() %} -    subnet6 {{ subnet }} { -{%         if subnet_config.address_range is vyos_defined %} -{%           if subnet_config.address_range.prefix is vyos_defined %} -{%             for prefix, prefix_config in subnet_config.address_range.prefix.items() %} -        range6 {{ prefix }} {{ "temporary" if prefix_config.temporary is vyos_defined }}; -{%             endfor %} -{%           endif %} -{%           if subnet_config.address_range.start is vyos_defined %} -{%             for address, address_config in subnet_config.address_range.start.items() %} -        range6 {{ address }} {{ address_config.stop }}; -{%             endfor %} -{%           endif %} -{%         endif %} -{%         if subnet_config.domain_search is vyos_defined %} -        option dhcp6.domain-search "{{ subnet_config.domain_search | join('", "') }}"; -{%         endif %} -{%         if subnet_config.lease_time is vyos_defined %} -{%           if subnet_config.lease_time.default is vyos_defined %} -        default-lease-time {{ subnet_config.lease_time.default }}; -{%           endif %} -{%           if subnet_config.lease_time.maximum is vyos_defined %} -        max-lease-time {{ subnet_config.lease_time.maximum }}; -{%           endif %} -{%           if subnet_config.lease_time.minimum is vyos_defined %} -        min-lease-time {{ subnet_config.lease_time.minimum }}; -{%           endif %} -{%         endif %} -{%         if subnet_config.name_server is vyos_defined %} -        option dhcp6.name-servers {{ subnet_config.name_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.nis_domain is vyos_defined %} -        option dhcp6.nis-domain-name "{{ subnet_config.nis_domain }}"; -{%         endif %} -{%         if subnet_config.nis_server is vyos_defined %} -        option dhcp6.nis-servers {{ subnet_config.nis_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.nisplus_domain is vyos_defined %} -        option dhcp6.nisp-domain-name "{{ subnet_config.nisplus_domain }}"; -{%         endif %} -{%         if subnet_config.nisplus_server is vyos_defined %} -        option dhcp6.nisp-servers {{ subnet_config.nisplus_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.sip_server is vyos_defined %} -{%           set server_ip = [] %} -{%           set server_fqdn = [] %} -{%           for address in subnet_config.sip_server %} -{%             if address | is_ipv6 %} -{%               set server_ip = server_ip.append(address) %} -{%             else %} -{%               set server_fqdn = server_fqdn.append(address) %} -{%             endif %} -{%           endfor %} -{%           if server_ip is vyos_defined and server_ip | length > 0 %} -        option dhcp6.sip-servers-addresses {{ server_ip | join(', ') }}; -{%           endif %} -{%           if server_fqdn is vyos_defined and server_fqdn | length > 0 %} -        option dhcp6.sip-servers-names "{{ server_fqdn | join('", "') }}"; -{%           endif %} -{%         endif %} -{%         if subnet_config.sntp_server is vyos_defined %} -        option dhcp6.sntp-servers {{ subnet_config.sntp_server | join(', ') }}; -{%         endif %} -{%         if subnet_config.prefix_delegation.start is vyos_defined %} -{%           for prefix, prefix_config in subnet_config.prefix_delegation.start.items() %} -        prefix6 {{ prefix }} {{ prefix_config.stop }} /{{ prefix_config.prefix_length }}; -{%           endfor %} -{%         endif %} -{%         if subnet_config.static_mapping is vyos_defined %} - -        # begin configuration of static client mappings -{%           for host, host_config in subnet_config.static_mapping.items() if host_config.disable is not vyos_defined %} -        host {{ network | replace('_','-') }}_{{ host | replace('_','-') }} { -{%             if host_config.identifier is vyos_defined %} -            host-identifier option dhcp6.client-id {{ host_config.identifier }}; -{%             endif %} -{%             if host_config.ipv6_address is vyos_defined %} -            fixed-address6 {{ host_config.ipv6_address }}; -{%             endif %} -{%             if host_config.ipv6_prefix is vyos_defined %} -            fixed-prefix6 {{ host_config.ipv6_prefix }}; -{%             endif %} -        } -{%           endfor %} -{%         endif %} -    } -{%       endfor %} -{%     endif %} -    on commit { -        set shared-networkname = "{{ network }}"; -    } -} -{%   endfor %} -{% endif %} diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index d27f8d995..52b682d6d 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -286,7 +286,7 @@ def generate(dhcp):      # Please see: https://phabricator.vyos.net/T1129 for quoting of the raw      # parameters we can pass to ISC DHCPd      tmp_file = '/tmp/dhcpd.conf' -    render(tmp_file, 'dhcp-server/dhcpd.conf.tmpl', dhcp, +    render(tmp_file, 'dhcp-server/dhcpd.conf.j2', dhcp,             formater=lambda _: _.replace(""", '"'))      # XXX: as we have the ability for a user to pass in "raw" options via VyOS      # CLI (see T3544) we now ask ISC dhcpd to test the newly rendered @@ -299,7 +299,7 @@ def generate(dhcp):      # Now that we know that the newly rendered configuration is "good" we can      # render the "real" configuration -    render(config_file, 'dhcp-server/dhcpd.conf.tmpl', dhcp, +    render(config_file, 'dhcp-server/dhcpd.conf.j2', dhcp,             formater=lambda _: _.replace(""", '"'))      return None diff --git a/src/conf_mode/dhcpv6_server.py b/src/conf_mode/dhcpv6_server.py index be1e6db1e..9922f2c5c 100755 --- a/src/conf_mode/dhcpv6_server.py +++ b/src/conf_mode/dhcpv6_server.py @@ -161,7 +161,7 @@ def generate(dhcpv6):      if not dhcpv6 or 'disable' in dhcpv6:          return None -    render(config_file, 'dhcp-server/dhcpdv6.conf.tmpl', dhcpv6) +    render(config_file, 'dhcp-server/dhcpdv6.conf.j2', dhcpv6)      return None  def apply(dhcpv6): | 
