From a2b6098e6f9c1915a61a9aebc8f9852bd897387c Mon Sep 17 00:00:00 2001 From: Lucas Christian Date: Sun, 11 Aug 2024 15:18:38 -0700 Subject: T6648: dhcpv6-server: align stateless DHCPv6 options with stateful --- interface-definitions/include/dhcp/option-v6.xml.i | 12 +++++++++ .../include/version/dhcpv6-server-version.xml.i | 2 +- interface-definitions/service_dhcpv6-server.xml.in | 22 +-------------- python/vyos/template.py | 4 +-- src/migration-scripts/dhcpv6-server/5-to-6 | 31 ++++++++++++++++++++++ 5 files changed, 47 insertions(+), 24 deletions(-) create mode 100644 src/migration-scripts/dhcpv6-server/5-to-6 diff --git a/interface-definitions/include/dhcp/option-v6.xml.i b/interface-definitions/include/dhcp/option-v6.xml.i index 1df0c3934..e1897f52d 100644 --- a/interface-definitions/include/dhcp/option-v6.xml.i +++ b/interface-definitions/include/dhcp/option-v6.xml.i @@ -78,6 +78,18 @@ + + + Time (in seconds) that stateless clients should wait between refreshing the information they were given + + u32:1-4294967295 + DHCPv6 information refresh time + + + + + + Vendor Specific Options diff --git a/interface-definitions/include/version/dhcpv6-server-version.xml.i b/interface-definitions/include/version/dhcpv6-server-version.xml.i index 1f30368a3..8b72a9c72 100644 --- a/interface-definitions/include/version/dhcpv6-server-version.xml.i +++ b/interface-definitions/include/version/dhcpv6-server-version.xml.i @@ -1,3 +1,3 @@ - + diff --git a/interface-definitions/service_dhcpv6-server.xml.in b/interface-definitions/service_dhcpv6-server.xml.in index daca7b43f..cf14388e8 100644 --- a/interface-definitions/service_dhcpv6-server.xml.in +++ b/interface-definitions/service_dhcpv6-server.xml.in @@ -63,27 +63,7 @@ - - - Common options to distribute to all clients, including stateless clients - - - - - Time (in seconds) that stateless clients should wait between refreshing the information they were given - - u32:1-4294967295 - DHCPv6 information refresh time - - - - - - - #include - #include - - + #include IPv6 DHCP subnet for this shared network diff --git a/python/vyos/template.py b/python/vyos/template.py index 3507e0940..aa99bed5a 100644 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -922,8 +922,8 @@ def kea6_shared_network_json(shared_networks): 'subnet6': [] } - if 'common_options' in config: - network['option-data'] = kea6_parse_options(config['common_options']) + if 'option' in config: + network['option-data'] = kea6_parse_options(config['option']) if 'interface' in config: network['interface'] = config['interface'] diff --git a/src/migration-scripts/dhcpv6-server/5-to-6 b/src/migration-scripts/dhcpv6-server/5-to-6 new file mode 100644 index 000000000..cad0a3538 --- /dev/null +++ b/src/migration-scripts/dhcpv6-server/5-to-6 @@ -0,0 +1,31 @@ +# Copyright 2024 VyOS maintainers and contributors +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see . + +# T6648: Rename "common-options" to "option" at shared-network level + +from vyos.configtree import ConfigTree + +base = ['service', 'dhcpv6-server', 'shared-network-name'] + +def migrate(config: ConfigTree) -> None: + if not config.exists(base): + # Nothing to do + return + + for network in config.list_nodes(base): + if not config.exists(base + [network, 'common-options']): + continue + + config.rename(base + [network, 'common-options'], 'option') -- cgit v1.2.3