diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/templates/dhcp-relay/dhcrelay.conf.tmpl | 2 | ||||
-rw-r--r-- | data/templates/dhcp-relay/dhcrelay6.conf.tmpl | 21 | ||||
-rw-r--r-- | data/templates/dhcp-server/dhcpd.conf.tmpl | 165 | ||||
-rw-r--r-- | data/templates/dhcp-server/dhcpdv6.conf.tmpl (renamed from data/templates/dhcpv6-server/dhcpdv6.conf.tmpl) | 0 | ||||
-rw-r--r-- | data/templates/dhcpv6-relay/config.tmpl | 4 | ||||
-rw-r--r-- | data/templates/frr/isis.frr.tmpl | 7 | ||||
-rw-r--r-- | data/templates/vyos-hostsd/hosts.tmpl | 14 |
7 files changed, 109 insertions, 104 deletions
diff --git a/data/templates/dhcp-relay/dhcrelay.conf.tmpl b/data/templates/dhcp-relay/dhcrelay.conf.tmpl index df990207b..a9d17ed9a 100644 --- a/data/templates/dhcp-relay/dhcrelay.conf.tmpl +++ b/data/templates/dhcp-relay/dhcrelay.conf.tmpl @@ -2,5 +2,5 @@ {% set max_size = '-A ' + relay_options.max_size if relay_options.max_size is defined and relay_options.max_size is not none %} {# hop_count and relay_agents_packets is a default option, thus it is always present #} -OPTIONS="-4 -c {{ relay_options.hop_count }} -a -m {{ relay_options.relay_agents_packets }} {{ max_size }} -i {{ interface | join(' -i ') }} {{ server | join(' ') }}" +OPTIONS="-c {{ relay_options.hop_count }} -a -m {{ relay_options.relay_agents_packets }} {{ max_size }} -i {{ interface | join(' -i ') }} {{ server | join(' ') }}" diff --git a/data/templates/dhcp-relay/dhcrelay6.conf.tmpl b/data/templates/dhcp-relay/dhcrelay6.conf.tmpl new file mode 100644 index 000000000..58c216b7c --- /dev/null +++ b/data/templates/dhcp-relay/dhcrelay6.conf.tmpl @@ -0,0 +1,21 @@ +### Autogenerated by dhcpv6_relay.py ### + +{# upstream_interface is mandatory so it's always present #} +{% set upstream = namespace(value='') %} +{% for interface, config in upstream_interface.items() %} +{% for address in config.address %} +{% set upstream.value = upstream.value + '-u ' + address + '%' + interface + ' ' %} +{% endfor %} +{% endfor %} +{# listen_interface is mandatory so it's always present #} +{% set listen = namespace(value='') %} +{% for interface, config in listen_interface.items() %} +{% if config.address is defined and config.address is not none %} +{% set listen.value = listen.value + '-l ' + config.address + '%' + interface + ' ' %} +{% else %} +{% set listen.value = listen.value + '-l ' + interface + ' ' %} +{% endif %} +{% endfor %} + +OPTIONS="{{ listen.value }} {{ upstream.value }} -c {{ max_hop_count }} {{ '-I' if use_interface_id_option is defined }}" + diff --git a/data/templates/dhcp-server/dhcpd.conf.tmpl b/data/templates/dhcp-server/dhcpd.conf.tmpl index f431d3207..d172018bf 100644 --- a/data/templates/dhcp-server/dhcpd.conf.tmpl +++ b/data/templates/dhcp-server/dhcpd.conf.tmpl @@ -1,4 +1,3 @@ - ### Autogenerated by dhcp_server.py ### # For options please consult the following website: @@ -23,10 +22,12 @@ on expiry { execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "release", ClientName, ClientIp, ClientMac, ClientDomain); } {% endif %} + {% if host_decl_name %} use-host-decl-names on; {% endif %} -ddns-update-style {% if ddns_enable %} interim {% else %} none {% endif %}; + +ddns-update-style {{ 'interim' if ddns_enable else 'none' }}; {% if static_route %} option rfc3442-static-route code 121 = array of integer 8; option windows-static-route code 249 = array of integer 8; @@ -37,24 +38,24 @@ option wpad-url code 252 = text; {% if global_parameters %} # The following {{ global_parameters | length }} line(s) were added as global-parameters in the CLI and have not been validated -{% for param in global_parameters %} +{% for param in global_parameters %} {{ param }} -{% endfor %} +{% endfor %} {% endif %} # Failover configuration {% for network in shared_network %} -{% if not network.disabled %} -{% for subnet in network.subnet %} -{% if subnet.failover_name %} +{% if not network.disabled %} +{% for subnet in network.subnet %} +{% if subnet.failover_name %} failover peer "{{ subnet.failover_name }}" { -{% if subnet.failover_status == 'primary' %} +{% if subnet.failover_status == 'primary' %} primary; mclt 1800; split 128; -{% elif subnet.failover_status == 'secondary' %} +{% elif subnet.failover_status == 'secondary' %} secondary; -{% endif %} +{% endif %} address {{ subnet.failover_local_addr }}; port 520; peer address {{ subnet.failover_peer_addr }}; @@ -63,109 +64,106 @@ failover peer "{{ subnet.failover_name }}" { max-unacked-updates 10; load balance max seconds 3; } -{% endif %} -{% endfor %} -{% endif %} +{% endif %} +{% endfor %} +{% endif %} {% endfor %} # Shared network configration(s) -{% for network in shared_network %} -{% if not network.disabled %} +{% for network in shared_network if not network.disabled %} shared-network {{ network.name }} { - {% if network.authoritative %} +{% if network.authoritative %} authoritative; - {% endif %} - {% if network.network_parameters %} +{% endif %} +{% if network.network_parameters %} # The following {{ network.network_parameters | length }} line(s) were added as shared-network-parameters in the CLI and have not been validated - {% for param in network.network_parameters %} +{% for param in network.network_parameters %} {{ param }} - {% endfor %} - {% endif %} - {% for subnet in network.subnet %} +{% endfor %} +{% endif %} +{% for subnet in network.subnet %} subnet {{ subnet.address }} netmask {{ subnet.netmask }} { - {% if subnet.dns_server %} +{% if subnet.dns_server %} option domain-name-servers {{ subnet.dns_server | join(', ') }}; - {% endif %} - {% if subnet.domain_search %} +{% endif %} +{% if subnet.domain_search %} option domain-search {{ subnet.domain_search | join(', ') }}; - {% endif %} - {% if subnet.ntp_server %} +{% endif %} +{% if subnet.ntp_server %} option ntp-servers {{ subnet.ntp_server | join(', ') }}; - {% endif %} - {% if subnet.pop_server %} +{% endif %} +{% if subnet.pop_server %} option pop-server {{ subnet.pop_server | join(', ') }}; - {% endif %} - {% if subnet.smtp_server %} +{% endif %} +{% if subnet.smtp_server %} option smtp-server {{ subnet.smtp_server | join(', ') }}; - {% endif %} - {% if subnet.time_server %} +{% endif %} +{% if subnet.time_server %} option time-servers {{ subnet.time_server | join(', ') }}; - {% endif %} - {% if subnet.wins_server %} +{% endif %} +{% if subnet.wins_server %} option netbios-name-servers {{ subnet.wins_server | join(', ') }}; - {% endif %} - {% if subnet.static_route %} +{% endif %} +{% if subnet.static_route %} option rfc3442-static-route {{ subnet.static_route }}{% if subnet.rfc3442_default_router %}, {{ subnet.rfc3442_default_router }}{% endif %}; option windows-static-route {{ subnet.static_route }}; - {% endif %} - {% if subnet.ip_forwarding %} +{% endif %} +{% if subnet.ip_forwarding %} option ip-forwarding true; - {% endif %} - {% if subnet.default_router %} +{% endif %} +{% if subnet.default_router %} option routers {{ subnet.default_router }}; - {% endif %} - {% if subnet.server_identifier %} +{% endif %} +{% if subnet.server_identifier %} option dhcp-server-identifier {{ subnet.server_identifier }}; - {% endif %} - {% if subnet.domain_name %} +{% endif %} +{% if subnet.domain_name %} option domain-name "{{ subnet.domain_name }}"; - {% endif %} - {% if subnet.subnet_parameters %} +{% endif %} +{% if subnet.subnet_parameters %} # The following {{ subnet.subnet_parameters | length }} line(s) were added as subnet-parameters in the CLI and have not been validated - {% for param in subnet.subnet_parameters %} +{% for param in subnet.subnet_parameters %} {{ param }} - {% endfor %} - {% endif %} - {% if subnet.tftp_server %} +{% endfor %} +{% endif %} +{% if subnet.tftp_server %} option tftp-server-name "{{ subnet.tftp_server }}"; - {% endif %} - {% if subnet.bootfile_name %} +{% endif %} +{% if subnet.bootfile_name %} option bootfile-name "{{ subnet.bootfile_name }}"; filename "{{ subnet.bootfile_name }}"; - {% endif %} - {% if subnet.bootfile_server %} +{% endif %} +{% if subnet.bootfile_server %} next-server {{ subnet.bootfile_server }}; - {% endif %} - {% if subnet.time_offset %} +{% endif %} +{% if subnet.time_offset %} option time-offset {{ subnet.time_offset }}; - {% endif %} - {% if subnet.wpad_url %} +{% endif %} +{% if subnet.wpad_url %} option wpad-url "{{ subnet.wpad_url }}"; - {% endif %} - {% if subnet.client_prefix_length %} +{% endif %} +{% if subnet.client_prefix_length %} option subnet-mask {{ subnet.client_prefix_length }}; - {% endif %} - {% if subnet.lease %} +{% endif %} +{% if subnet.lease %} default-lease-time {{ subnet.lease }}; max-lease-time {{ subnet.lease }}; - {% endif %} - {% for host in subnet.static_mapping %} - {% if not host.disabled %} - host {% if host_decl_name %} {{ host.name }} {% else %} {{ network.name }}_{{ host.name }} {% endif %} { - {% if host.ip_address %} +{% endif %} +{% for host in subnet.static_mapping if not host.disabled %} + host {{ host.name if host_decl_name else network.name + '_' + host.name }} { +{% if host.ip_address %} fixed-address {{ host.ip_address }}; - {% endif %} +{% endif %} hardware ethernet {{ host.mac_address }}; - {% if host.static_parameters %} +{% if host.static_parameters %} # The following {{ host.static_parameters | length }} line(s) were added as static-mapping-parameters in the CLI and have not been validated - {% for param in host.static_parameters %} +{% for param in host.static_parameters %} {{ param }} - {% endfor %} - {% endif %} +{% endfor %} +{% endif %} } - {% endif %} - {% endfor %} - {% if subnet.failover_name %} +{% endfor %} +{% if subnet.failover_name %} pool { failover peer "{{ subnet.failover_name }}"; deny dynamic bootp clients; @@ -173,23 +171,22 @@ shared-network {{ network.name }} { range {{ range.start }} {{ range.stop }}; {% endfor %} } - {% else %} - {% for range in subnet.range %} +{% else %} +{% for range in subnet.range %} range {{ range.start }} {{ range.stop }}; - {% endfor %} - {% endif %} +{% endfor %} +{% endif %} } - {% endfor %} +{% endfor %} on commit { set shared-networkname = "{{ network.name }}"; - {% if hostfile_update %} +{% if hostfile_update %} set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name); set ClientIp = binary-to-ascii(10, 8, ".", leased-address); set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!"); execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain); - {% endif %} +{% endif %} } } -{% endif %} {% endfor %} diff --git a/data/templates/dhcpv6-server/dhcpdv6.conf.tmpl b/data/templates/dhcp-server/dhcpdv6.conf.tmpl index aa6d7fb5d..aa6d7fb5d 100644 --- a/data/templates/dhcpv6-server/dhcpdv6.conf.tmpl +++ b/data/templates/dhcp-server/dhcpdv6.conf.tmpl diff --git a/data/templates/dhcpv6-relay/config.tmpl b/data/templates/dhcpv6-relay/config.tmpl deleted file mode 100644 index 55035ae6c..000000000 --- a/data/templates/dhcpv6-relay/config.tmpl +++ /dev/null @@ -1,4 +0,0 @@ -### Autogenerated by dhcpv6_relay.py ### - -# Defaults for isc-dhcp-relay6.service -OPTIONS="-l {{ listen_addr | join(' -l ') }} -u {{ upstream_addr | join(' -u ') }} {{ options | join(' ') }}" diff --git a/data/templates/frr/isis.frr.tmpl b/data/templates/frr/isis.frr.tmpl index 929f5bdb2..a1dae0c7c 100644 --- a/data/templates/frr/isis.frr.tmpl +++ b/data/templates/frr/isis.frr.tmpl @@ -70,13 +70,6 @@ router isis {{ process }} {% endif %} {% endif %} ! -{% if interface_remove is defined and interface_remove is not none %} -{% for iface in interface_remove %} -interface {{ iface }} - no ip router isis -{% endfor %} -{% endif %} -! {% if interface is defined and interface is not none %} {% for iface, iface_config in interface.items() %} interface {{ iface }} diff --git a/data/templates/vyos-hostsd/hosts.tmpl b/data/templates/vyos-hostsd/hosts.tmpl index be8692104..8b73c6e51 100644 --- a/data/templates/vyos-hostsd/hosts.tmpl +++ b/data/templates/vyos-hostsd/hosts.tmpl @@ -12,15 +12,13 @@ ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters -{% if hosts %} +{% if hosts is defined and hosts is not none %} # From 'system static-host-mapping' and DHCP server -{% for tag, taghosts in hosts.items() %} +{% for tag, taghosts in hosts.items() %} # {{ tag }} -{% for host, hostprops in taghosts.items() %} -{% if hostprops['address'] %} -{{ hostprops['address'] }} {{ host }}{% for a in hostprops['aliases'] %} {{ a }}{% endfor %} -{% endif %} -{% endfor %} -{% endfor %} +{% for host, hostprops in taghosts.items() if hostprops.address is defined %} +{{ "%-15s" | format(hostprops.address) }} {{ host }} {{ hostprops.aliases|join(' ') if hostprops.aliases is defined }} +{% endfor %} +{% endfor %} {% endif %} |