diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-18 12:35:10 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-18 14:31:51 +0200 |
commit | 901d5e89ec6e3fb0f3d13f90f0495a4dda592454 (patch) | |
tree | 6a18d5bcbfa1fbdf7d83d1ba828a7641ac694af5 /src/conf_mode | |
parent | 3a81e26a23b5e1b372bfa15c63dbc725a2f448ed (diff) | |
download | vyos-1x-901d5e89ec6e3fb0f3d13f90f0495a4dda592454.tar.gz vyos-1x-901d5e89ec6e3fb0f3d13f90f0495a4dda592454.zip |
pppoe-server: T2314: migrate IPv6 to common CLI nodes with embeeded validation
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/service_pppoe-server.py | 32 | ||||
-rwxr-xr-x | src/conf_mode/vpn_l2tp.py | 2 |
2 files changed, 29 insertions, 5 deletions
diff --git a/src/conf_mode/service_pppoe-server.py b/src/conf_mode/service_pppoe-server.py index 52be86b14..aa8b9d141 100755 --- a/src/conf_mode/service_pppoe-server.py +++ b/src/conf_mode/service_pppoe-server.py @@ -35,7 +35,8 @@ default_config_data = { 'chap_secrets_file': pppoe_chap_secrets, # used in Jinja2 template 'client_ip_pool': '', 'client_ip_subnets': [], - 'client_ipv6_pool': {}, + 'client_ipv6_pool': [], + 'client_ipv6_delegate_prefix': [], 'concentrator': 'vyos-ac', 'interfaces': [], 'local_users' : [], @@ -130,6 +131,7 @@ def get_config(): if conf.exists(['wins-server']): pppoe['wins'] = conf.return_values(['wins-server']) + if conf.exists(['client-ip-pool']): if conf.exists(['client-ip-pool', 'start']) and conf.exists(['client-ip-pool', 'stop']): start = conf.return_value(['client-ip-pool', 'start']) @@ -139,10 +141,32 @@ def get_config(): if conf.exists(['client-ip-pool', 'subnet']): pppoe['client_ip_subnets'] = conf.return_values(['client-ip-pool', 'subnet']) + if conf.exists(['client-ipv6-pool', 'prefix']): - pppoe['client_ipv6_pool']['prefix'] = conf.return_values(['client-ipv6-pool', 'prefix']) - if conf.exists(['client-ipv6-pool', 'delegate-prefix']): - pppoe['client_ipv6_pool']['delegate-prefix'] = conf.return_values(['client-ipv6-pool', 'delegate-prefix']) + for prefix in conf.list_nodes(['client-ipv6-pool', 'prefix']): + tmp = { + 'prefix': prefix, + 'mask': '64' + } + + if conf.exists(['client-ipv6-pool', 'prefix', prefix, 'mask']): + tmp['mask'] = conf.return_value(['client-ipv6-pool', 'prefix', prefix, 'mask']) + + pppoe['client_ipv6_pool'].append(tmp) + + + if conf.exists(['client-ipv6-pool', 'delegate']): + for prefix in conf.list_nodes(['client-ipv6-pool', 'delegate']): + tmp = { + 'prefix': prefix, + 'mask': '' + } + + if conf.exists(['client-ipv6-pool', 'delegate', prefix, 'delegation-prefix']): + tmp['mask'] = conf.return_value(['client-ipv6-pool', 'delegate', prefix, 'delegation-prefix']) + + pppoe['client_ipv6_delegate_prefix'].append(tmp) + if conf.exists(['limits']): if conf.exists(['limits', 'burst']): diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py index 06803e7e0..331f22465 100755 --- a/src/conf_mode/vpn_l2tp.py +++ b/src/conf_mode/vpn_l2tp.py @@ -252,7 +252,7 @@ def get_config(): 'mask': '' } - if conf.exists(['client-ipv6-pool', 'delegate', prefix, 'mask']): + if conf.exists(['client-ipv6-pool', 'delegate', prefix, 'delegation-prefix']): tmp['mask'] = conf.return_value(['client-ipv6-pool', 'delegate', prefix, 'delegation-prefix']) l2tp['client_ipv6_delegate_prefix'].append(tmp) |