diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-12-28 21:28:03 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-28 21:28:03 +0000 |
commit | 0e8799091f7e49c4810320a47dd19c554955d007 (patch) | |
tree | 297973a17ebbe238b4a707e17685f656530a0881 /data/templates/accel-ppp/config_ip_pool.j2 | |
parent | 35615152cae072af685f6475af1af5a070015a4d (diff) | |
parent | e0c7d8a8305925c26073098474ed230da05fae11 (diff) | |
download | vyos-1x-0e8799091f7e49c4810320a47dd19c554955d007.tar.gz vyos-1x-0e8799091f7e49c4810320a47dd19c554955d007.zip |
Merge pull request #2700 from vyos/mergify/bp/sagitta/pr-2501
accel-ppp: T5688: Standardized pool configuration in accel-ppp (backport #2501)
Diffstat (limited to 'data/templates/accel-ppp/config_ip_pool.j2')
-rw-r--r-- | data/templates/accel-ppp/config_ip_pool.j2 | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/data/templates/accel-ppp/config_ip_pool.j2 b/data/templates/accel-ppp/config_ip_pool.j2 index f7511e445..6ac04e1a1 100644 --- a/data/templates/accel-ppp/config_ip_pool.j2 +++ b/data/templates/accel-ppp/config_ip_pool.j2 @@ -1,24 +1,28 @@ -{% if client_ip_pool is vyos_defined %} +{% if ordered_named_pools is vyos_defined %} [ip-pool] {% if gateway_address is vyos_defined %} +{% if server_type == 'ipoe' %} +{% for gw in gateway_address %} +{% set host_address, _ = gw.split('/') %} +gw-ip-address={{ host_address }} +{% endfor %} +{% else %} gw-ip-address={{ gateway_address }} +{% endif %} {% endif %} -{% if client_ip_pool.start is vyos_defined and client_ip_pool.stop is vyos_defined %} -{{ client_ip_pool.start }}-{{ client_ip_pool.stop.split('.')[3] }} -{% endif %} -{% if client_ip_pool.subnet is vyos_defined %} -{% for subnet in client_ip_pool.subnet %} -{{ subnet }} -{% endfor %} -{% endif %} -{% if client_ip_pool.name is vyos_defined %} -{% for pool, pool_config in client_ip_pool.name.items() %} -{% if pool_config.subnet is vyos_defined %} -{{ pool_config.subnet }},name={{ pool }} +{% for pool in ordered_named_pools %} +{% for pool_name, pool_config in pool.items() %} +{% set iprange_str = pool_config.range %} +{% set iprange_list = pool_config.range.split('-') %} +{% if iprange_list | length == 2 %} +{% set last_ip_oct = iprange_list[1].split('.') %} +{% set iprange_str = iprange_list[0] + '-' + last_ip_oct[last_ip_oct | length - 1] %} {% endif %} -{% if pool_config.gateway_address is vyos_defined %} -gw-ip-address={{ pool_config.gateway_address }} +{% if pool_config.next_pool is vyos_defined %} +{{ iprange_str }},name={{ pool_name }},next={{ pool_config.next_pool }} +{% else %} +{{ iprange_str }},name={{ pool_name }} {% endif %} {% endfor %} -{% endif %} +{% endfor %} {% endif %}
\ No newline at end of file |