summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/ipoe-server/ipoe.config.tmpl6
-rw-r--r--interface-definitions/service_ipoe-server.xml.in20
-rwxr-xr-xsrc/conf_mode/service_ipoe-server.py25
-rwxr-xr-xsrc/migration-scripts/ipoe-server/0-to-128
4 files changed, 54 insertions, 25 deletions
diff --git a/data/templates/ipoe-server/ipoe.config.tmpl b/data/templates/ipoe-server/ipoe.config.tmpl
index 1f34b67c8..19d8b199d 100644
--- a/data/templates/ipoe-server/ipoe.config.tmpl
+++ b/data/templates/ipoe-server/ipoe.config.tmpl
@@ -63,10 +63,10 @@ verbose=1
{% if client_ipv6_pool %}
[ipv6-pool]
{% for p in client_ipv6_pool %}
-{{ p }}
+{{ p.prefix }},{{ p.mask }}
{% endfor %}
-{% for pd in client_ipv6_delegate_prefix %}
-delegate={{ pd }}
+{% for p in client_ipv6_delegate_prefix %}
+delegate={{ p.prefix }},{{ p.mask }}
{% endfor %}
{% endif %}
diff --git a/interface-definitions/service_ipoe-server.xml.in b/interface-definitions/service_ipoe-server.xml.in
index decd94060..9d6c7d4f1 100644
--- a/interface-definitions/service_ipoe-server.xml.in
+++ b/interface-definitions/service_ipoe-server.xml.in
@@ -129,25 +129,7 @@
<multi/>
</properties>
</leafNode>
- <node name="client-ipv6-pool">
- <properties>
- <help>Pool of client IPv6 addresses</help>
- </properties>
- <children>
- <leafNode name="prefix">
- <properties>
- <help>Format: ipv6prefix/mask,prefix_len (e.g.: fc00:0:1::/48,64 - divides prefix into /64 subnets for clients)</help>
- <multi/>
- </properties>
- </leafNode>
- <leafNode name="delegate-prefix">
- <properties>
- <help>Format: ipv6prefix/mask,prefix_len (delegates prefix to clients via DHCPv6 prefix delegation</help>
- <multi/>
- </properties>
- </leafNode>
- </children>
- </node>
+ #include <include/accel-client-ipv6-pool.xml.in>
<node name="authentication">
<properties>
<help>Client authentication methods</help>
diff --git a/src/conf_mode/service_ipoe-server.py b/src/conf_mode/service_ipoe-server.py
index 958fbd561..428d8d5d5 100755
--- a/src/conf_mode/service_ipoe-server.py
+++ b/src/conf_mode/service_ipoe-server.py
@@ -202,10 +202,29 @@ def get_config():
conf.set_level(base_path)
if conf.exists(['client-ipv6-pool', 'prefix']):
- ipoe['client_ipv6_pool'] = conf.return_values(['client-ipv6-pool', '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'])
+
+ ipoe['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'])
- if conf.exists(['client-ipv6-pool', 'delegate-prefix']):
- ipoe['client_ipv6_delegate_prefix'] = conf.return_values(['client-ipv6-pool', 'delegate-prefix'])
+ ipoe['client_ipv6_delegate_prefix'].append(tmp)
return ipoe
diff --git a/src/migration-scripts/ipoe-server/0-to-1 b/src/migration-scripts/ipoe-server/0-to-1
index c04a7fb19..1ae1ad61c 100755
--- a/src/migration-scripts/ipoe-server/0-to-1
+++ b/src/migration-scripts/ipoe-server/0-to-1
@@ -81,6 +81,34 @@ else:
config.delete(radius_server)
+ # Migrate IPv6 prefixes
+ ipv6_base = base + ['client-ipv6-pool']
+ if config.exists(ipv6_base + ['prefix']):
+ prefix_old = config.return_values(ipv6_base + ['prefix'])
+ # delete old prefix CLI nodes
+ config.delete(ipv6_base + ['prefix'])
+ # create ned prefix tag node
+ config.set(ipv6_base + ['prefix'])
+ config.set_tag(ipv6_base + ['prefix'])
+
+ for p in prefix_old:
+ prefix = p.split(',')[0]
+ mask = p.split(',')[1]
+ config.set(ipv6_base + ['prefix', prefix, 'mask'], value=mask)
+
+ if config.exists(ipv6_base + ['delegate-prefix']):
+ prefix_old = config.return_values(ipv6_base + ['delegate-prefix'])
+ # delete old delegate prefix CLI nodes
+ config.delete(ipv6_base + ['delegate-prefix'])
+ # create ned delegation tag node
+ config.set(ipv6_base + ['delegate'])
+ config.set_tag(ipv6_base + ['delegate'])
+
+ for p in prefix_old:
+ prefix = p.split(',')[0]
+ mask = p.split(',')[1]
+ config.set(ipv6_base + ['delegate', prefix, 'delegation-prefix'], value=mask)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())