From 2ec93410070a5a4a42a298c3817ec8366e85b84d Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 8 Nov 2026 10:39:06 -0300 Subject: [PATCH] test(xcat-core): a reserved DHCPv6 address must be free for the next boot stage A boot chain presents one DUID in several stages, and each stage asks for its own IA. Kea holds a reclaimed lease for an hour by default, so the reserved address a boot loader released is still bound to the IAID of the loader when the Genesis image asks for it. The image is given a pool address, and xcatd names a node by the address it speaks from. The new assertions read expired-leases-processing out of the rendered DHCPv6 document. They fail on this commit, because render_dhcp6_config writes no such block and all three Kea defaults apply. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/unit/dhcp_kea_renderer.t | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT-test/unit/dhcp_kea_renderer.t b/xCAT-test/unit/dhcp_kea_renderer.t index e74d0cc940..8c51e7463f 100644 --- a/xCAT-test/unit/dhcp_kea_renderer.t +++ b/xCAT-test/unit/dhcp_kea_renderer.t @@ -503,6 +503,20 @@ ok( $dhcp6_config->{Dhcp6}, 'renderer creates a Dhcp6 document' ); is( $dhcp6_config->{Dhcp6}{subnet6}[0]{subnet}, '2001:db8:1::/64', 'DHCPv6 subnet is rendered' ); is( $dhcp6_config->{Dhcp6}{'valid-lifetime'}, 700, 'DHCPv6 valid lifetime is numeric' ); is( $dhcp6_config->{Dhcp6}{'preferred-lifetime'}, 500, 'DHCPv6 preferred lifetime is numeric' ); + +# A boot chain presents one DUID in several stages, and each stage asks for a different IA. +# Kea holds a reclaimed lease for an hour by default, so the reserved address the firmware +# released is still bound to the IAID of the firmware when the Genesis image asks for it, and +# the image is given a pool address instead. xcatd names a node by the address it speaks from. +my $expired6 = $dhcp6_config->{Dhcp6}{'expired-leases-processing'}; +is( $expired6->{'hold-reclaimed-time'}, 0, 'a released reserved address is not held for the next boot stage' ); +is( $expired6->{'flush-reclaimed-timer-wait-time'}, 5, 'reclaimed leases are flushed inside one boot' ); +is( $expired6->{'reclaim-timer-wait-time'}, 5, 'a released lease is reclaimed inside one boot' ); + +my $expired6_override = decode_json( + $backend->render_dhcp6_config( { 'expired-leases-processing' => { 'hold-reclaimed-time' => 900 } } ) +)->{Dhcp6}{'expired-leases-processing'}; +is( $expired6_override->{'hold-reclaimed-time'}, 900, 'the caller can still choose how long a reclaimed lease is held' ); is( $dhcp6_config->{Dhcp6}{subnet6}[0]{id}, 11, 'DHCPv6 subnet id is numeric' ); is( $dhcp6_config->{Dhcp6}{subnet6}[0]{reservations}[0]{duid}, '00:04:52:54:00:12:34:56', 'DHCPv6 DUID reservation is rendered' ); my $dhcp6_bootfile = $dhcp6_config->{Dhcp6}{subnet6}[0]{reservations}[0]{'option-data'}[0];