summaryrefslogtreecommitdiff
path: root/data/templates/accel-ppp/chap-secrets.ipoe.j2
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-09-17 22:28:34 +0200
committerChristian Poessinger <christian@poessinger.com>2022-09-21 16:34:25 +0200
commit05df2a5f021f0c7aab7c06db645d210858b6e98d (patch)
tree96b08be53303b3c30f24829d5538bc41dc010bea /data/templates/accel-ppp/chap-secrets.ipoe.j2
parent87d54b805f6fe1ede06387241117d492334bee31 (diff)
downloadvyos-1x-05df2a5f021f0c7aab7c06db645d210858b6e98d.tar.gz
vyos-1x-05df2a5f021f0c7aab7c06db645d210858b6e98d.zip
ipoe: T4678: T4703: rewrite to get_config_dict()
In addition to the rewrite to make use of get_config_dict() the CLI is slightly adjusted as specified in T4703. * Rename vlan-id and vlan-range to simply vlan * Rename network-mode to simply mode * Re-use existing common Jinja2 template for Accel-PPP which are shared with PPPoE and SSTP server. * Retrieve default values via defaultValue XML node
Diffstat (limited to 'data/templates/accel-ppp/chap-secrets.ipoe.j2')
-rw-r--r--data/templates/accel-ppp/chap-secrets.ipoe.j225
1 files changed, 10 insertions, 15 deletions
diff --git a/data/templates/accel-ppp/chap-secrets.ipoe.j2 b/data/templates/accel-ppp/chap-secrets.ipoe.j2
index a1430ec22..43083e22e 100644
--- a/data/templates/accel-ppp/chap-secrets.ipoe.j2
+++ b/data/templates/accel-ppp/chap-secrets.ipoe.j2
@@ -1,18 +1,13 @@
# username server password acceptable local IP addresses shaper
-{% for interface in auth_interfaces %}
-{% for mac in interface.mac %}
-{% if mac.rate_upload and mac.rate_download %}
-{% if mac.vlan_id %}
-{{ interface.name }}.{{ mac.vlan_id }} * {{ mac.address | lower }} * {{ mac.rate_download }}/{{ mac.rate_upload }}
-{% else %}
-{{ interface.name }} * {{ mac.address | lower }} * {{ mac.rate_download }}/{{ mac.rate_upload }}
-{% endif %}
-{% else %}
-{% if mac.vlan_id %}
-{{ interface.name }}.{{ mac.vlan_id }} * {{ mac.address | lower }} *
-{% else %}
-{{ interface.name }} * {{ mac.address | lower }} *
-{% endif %}
+{% if authentication.interface is vyos_defined %}
+{% for iface, iface_config in authentication.interface.items() %}
+{% if iface_config.mac is vyos_defined %}
+{% for mac, mac_config in iface_config.mac.items() %}
+{% if mac_config.vlan is vyos_defined %}
+{% set iface = iface ~ '.' ~ mac_config.vlan %}
+{% endif %}
+{{ "%-11s" | format(iface) }} * {{ mac | lower }} * {{ mac_config.rate_limit.download ~ '/' ~ mac_config.rate_limit.upload if mac_config.rate_limit.download is vyos_defined and mac_config.rate_limit.upload is vyos_defined }}
+{% endfor %}
{% endif %}
{% endfor %}
-{% endfor %}
+{% endif %}