diff options
author | Christian Breunig <christian@breunig.cc> | 2024-01-13 20:12:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-13 20:12:33 +0100 |
commit | 9753fafbfed02a3b6ebe7b6ddf51783c5dcbcf62 (patch) | |
tree | 929c8b42867462edad25b8028bac07b78c89b6fb /src/migration-scripts/dhcpv6-server/3-to-4 | |
parent | fef091bd6dc5c3cdfae47e9adb86f610a75a8a4d (diff) | |
parent | 2d4db25386fcefd301868a4daa39d5578cbac779 (diff) | |
download | vyos-1x-9753fafbfed02a3b6ebe7b6ddf51783c5dcbcf62.tar.gz vyos-1x-9753fafbfed02a3b6ebe7b6ddf51783c5dcbcf62.zip |
Merge pull request #2817 from sarthurdev/kea6-options
dhcpv6: T3316: Extend scope of DHCP options, bugfixes
Diffstat (limited to 'src/migration-scripts/dhcpv6-server/3-to-4')
-rwxr-xr-x | src/migration-scripts/dhcpv6-server/3-to-4 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/migration-scripts/dhcpv6-server/3-to-4 b/src/migration-scripts/dhcpv6-server/3-to-4 index c065e3d43..4747ebd60 100755 --- a/src/migration-scripts/dhcpv6-server/3-to-4 +++ b/src/migration-scripts/dhcpv6-server/3-to-4 @@ -16,6 +16,8 @@ # T3316: # - Add subnet IDs to existing subnets +# - Move options to option node +# - Migrate address-range to range tagNode import sys import re @@ -37,6 +39,10 @@ if not config.exists(base): # Nothing to do sys.exit(0) +option_nodes = ['captive-portal', 'domain-search', 'name-server', + 'nis-domain', 'nis-server', 'nisplus-domain', 'nisplus-server', + 'sip-server', 'sntp-server', 'vendor-option'] + subnet_id = 1 for network in config.list_nodes(base): @@ -44,6 +50,35 @@ for network in config.list_nodes(base): for subnet in config.list_nodes(base + [network, 'subnet']): base_subnet = base + [network, 'subnet', subnet] + if config.exists(base_subnet + ['address-range']): + config.set(base_subnet + ['range']) + config.set_tag(base_subnet + ['range']) + + range_id = 1 + + if config.exists(base_subnet + ['address-range', 'prefix']): + for prefix in config.return_values(base_subnet + ['address-range', 'prefix']): + config.set(base_subnet + ['range', range_id, 'prefix'], value=prefix) + + range_id += 1 + + if config.exists(base_subnet + ['address-range', 'start']): + for start in config.list_nodes(base_subnet + ['address-range', 'start']): + stop = config.return_value(base_subnet + ['address-range', 'start', start, 'stop']) + + config.set(base_subnet + ['range', range_id, 'start'], value=start) + config.set(base_subnet + ['range', range_id, 'stop'], value=stop) + + range_id += 1 + + config.delete(base_subnet + ['address-range']) + + for option in option_nodes: + if config.exists(base_subnet + [option]): + config.set(base_subnet + ['option']) + config.copy(base_subnet + [option], base_subnet + ['option', option]) + config.delete(base_subnet + [option]) + config.set(base_subnet + ['subnet-id'], value=subnet_id) subnet_id += 1 |