summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-18 12:35:10 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-18 14:31:51 +0200
commit901d5e89ec6e3fb0f3d13f90f0495a4dda592454 (patch)
tree6a18d5bcbfa1fbdf7d83d1ba828a7641ac694af5 /src/migration-scripts
parent3a81e26a23b5e1b372bfa15c63dbc725a2f448ed (diff)
downloadvyos-1x-901d5e89ec6e3fb0f3d13f90f0495a4dda592454.tar.gz
vyos-1x-901d5e89ec6e3fb0f3d13f90f0495a4dda592454.zip
pppoe-server: T2314: migrate IPv6 to common CLI nodes with embeeded validation
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-xsrc/migration-scripts/l2tp/2-to-36
-rwxr-xr-xsrc/migration-scripts/pppoe-server/2-to-331
2 files changed, 34 insertions, 3 deletions
diff --git a/src/migration-scripts/l2tp/2-to-3 b/src/migration-scripts/l2tp/2-to-3
index bd0839e03..3472ee3ed 100755
--- a/src/migration-scripts/l2tp/2-to-3
+++ b/src/migration-scripts/l2tp/2-to-3
@@ -95,13 +95,13 @@ else:
# 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 '])
+ 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, 'mask'], value=mask)
+ config.set(ipv6_base + ['delegate', prefix, 'delegate-prefix'], value=mask)
try:
with open(file_name, 'w') as f:
diff --git a/src/migration-scripts/pppoe-server/2-to-3 b/src/migration-scripts/pppoe-server/2-to-3
index 977f1ef43..eb3e00b8b 100755
--- a/src/migration-scripts/pppoe-server/2-to-3
+++ b/src/migration-scripts/pppoe-server/2-to-3
@@ -75,6 +75,37 @@ else:
if config.exists(radius_base + ['server', server, 'req-limit']):
config.delete(radius_base + ['server', server, 'req-limit'])
+ # 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)
+
+ print(config.to_string())
+ exit(1)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())