{# j2lint: disable=operator-enclosed-by-spaces #}
### generated by ipoe.py ###
[modules]
log_syslog
ipoe
shaper
{# Common authentication backend definitions #}
{% include 'accel-ppp/config_modules_auth_mode.j2' %}
ippool
ipv6pool
ipv6_nd
ipv6_dhcp
{% if snmp is vyos_defined %}
net-snmp
{% endif %}
{% if limits is vyos_defined %}
connlimit
{% endif %}

[core]
thread-count={{ thread_count }}

[common]
{% if max_concurrent_sessions is vyos_defined %}
max-starting={{ max_concurrent_sessions }}
{% endif %}


[log]
syslog=accel-ipoe,daemon
copy=1
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

[ipoe]
verbose=1
{% if interface is vyos_defined %}
{%     for iface, iface_config in interface.items() %}
{%         set tmp = 'interface=' %}
{%         if iface_config.vlan is vyos_defined %}
{%             set tmp = tmp ~ 're:^' ~ iface ~ '\.' ~ iface_config.vlan | range_to_regex ~ '$' %}
{%         else %}
{%             set tmp = tmp ~ iface %}
{%         endif %}
{%         set shared = '' %}
{%         if iface_config.network is vyos_defined('shared') %}
{%             set shared = 'shared=1,' %}
{%         elif iface_config.network is vyos_defined('vlan') %}
{%             set shared = 'shared=0,' %}
{%         endif %}
{%         set range = 'range=' ~ iface_config.client_subnet ~ ',' if iface_config.client_subnet is vyos_defined else '' %}
{%         set relay = ',' ~ 'relay=' ~ iface_config.external_dhcp.dhcp_relay  if iface_config.external_dhcp.dhcp_relay is vyos_defined else '' %}
{%         set giaddr = ',' ~ 'giaddr=' ~ iface_config.external_dhcp.giaddr if iface_config.external_dhcp.giaddr is vyos_defined else '' %}
{{ tmp }},{{ shared }}mode={{ iface_config.mode | upper }},ifcfg=1,{{ range }}start=dhcpv4,ipv6=1{{ relay }}{{ giaddr }}
{%         if iface_config.vlan is vyos_defined %}
vlan-mon={{ iface }},{{ iface_config.vlan | join(',') }}
{%         endif %}
{%     endfor %}
{% endif %}
{% if authentication.mode is vyos_defined('noauth') %}
noauth=1
{% elif authentication.mode is vyos_defined('local') %}
username=ifname
password=csid
{% endif %}
{% if default_pool is vyos_defined %}
ip-pool={{ default_pool }}
{% endif %}
{% if default_ipv6_pool is vyos_defined %}
ipv6-pool={{ default_ipv6_pool }}
ipv6-pool-delegate={{ default_ipv6_pool }}
{% endif %}
{% if gateway_address is vyos_defined %}
{%     for gw_addr in gateway_address %}
gw-ip-address={{ gw_addr }}
{%     endfor %}
{% endif %}
proxy-arp=1

{# Common IP pool definitions #}
{% include 'accel-ppp/config_ip_pool.j2' %}

{# Common IPv6 pool definitions #}
{% include 'accel-ppp/config_ipv6_pool.j2' %}

{# Common DNS name-server definition #}
{% include 'accel-ppp/config_name_server.j2' %}

{# Common chap-secrets and RADIUS server/option definitions #}
{% include 'accel-ppp/config_chap_secrets_radius.j2' %}

{# Common RADIUS shaper configuration #}
{% include 'accel-ppp/config_shaper_radius.j2' %}

{# Common Extended scripts configuration #}
{% include 'accel-ppp/config_extended_scripts.j2' %}

{# Common Limits configuration #}
{% include 'accel-ppp/config_limits.j2' %}

{# Common SNMP definitions #}
{% include 'accel-ppp/config_snmp.j2' %}

[cli]
tcp=127.0.0.1:2002