diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-15 22:51:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 22:51:30 +0100 |
commit | 5d6726b04c49f97814e1a39149df03b3a785938e (patch) | |
tree | 7649ed5025d40f9deba2df2147fcc1772c1acdf3 /src/conf_mode | |
parent | a56cc7ea419241dab9d26aa2d9046c6bf32cf026 (diff) | |
parent | a43db38e72da8bfebc42d3a0ecedc8ae79383c5d (diff) | |
download | vyos-1x-5d6726b04c49f97814e1a39149df03b3a785938e.tar.gz vyos-1x-5d6726b04c49f97814e1a39149df03b3a785938e.zip |
Merge pull request #1106 from DmitriyEshenko/equuleus-15122021
pppoe-server: T3006: Add range to regex generator
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/service_pppoe-server.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/conf_mode/service_pppoe-server.py b/src/conf_mode/service_pppoe-server.py index 9fbd531da..f6182f8ea 100755 --- a/src/conf_mode/service_pppoe-server.py +++ b/src/conf_mode/service_pppoe-server.py @@ -24,6 +24,8 @@ from vyos.configverify import verify_accel_ppp_base_service from vyos.template import render from vyos.util import call from vyos.util import dict_search +from vyos.util import get_interface_config +from vyos.range_regex import range_to_regex from vyos import ConfigError from vyos import airbag airbag.enable() @@ -56,6 +58,11 @@ def verify(pppoe): if 'interface' not in pppoe: raise ConfigError('At least one listen interface must be defined!') + # Check is interface exists in the system + for iface in pppoe['interface']: + if not get_interface_config(iface): + raise ConfigError(f'Interface {iface} does not exist!') + # local ippool and gateway settings config checks if not (dict_search('client_ip_pool.subnet', pppoe) or (dict_search('client_ip_pool.start', pppoe) and @@ -73,6 +80,13 @@ def generate(pppoe): if not pppoe: return None + # Generate special regex for dynamic interfaces + for iface, iface_options in pppoe['interface'].items(): + if 'vlan_range' in iface_options: + pppoe['interface'][iface]['regex'] = [] + for vlan_range in iface_options['vlan_range']: + pppoe['interface'][iface]['regex'].append(range_to_regex(vlan_range)) + render(pppoe_conf, 'accel-ppp/pppoe.config.tmpl', pppoe) if dict_search('authentication.mode', pppoe) == 'local': |