2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-24 19:32:17 +00:00
Files
xcat-core/xCAT-test/unit/genesis_openembedded_duid.t
T
Daniel Hilst f775471804 test(xcat-core): the OpenEmbedded Genesis DUID matches no reservation
The OpenEmbedded Genesis image sets ipv6.dhcp-duid=ll, so NetworkManager sends a
DUID-LL. makedhcp builds a DUID-UUID from vpd.uuid, and kea_node_reservations6 puts
either a duid or a hw-address in a reservation, never both. A node that reported an
SMBIOS UUID therefore gets a DUID-only reservation that its DUID-LL cannot match: it
takes a pool address with no bootfile-url and does not netboot over IPv6. The legacy
image is correct here, because doxcat writes a DUID-UUID in firmware order.

genesis_openembedded_duid.bats asserts the image turns the SMBIOS UUID into the same
DUID that xCAT-test/bats/genesis_duid_uuid.bats pins for the legacy image, and that a
node with no SMBIOS UUID keeps the DUID-LL, which is what a hw-address reservation
needs. genesis_openembedded_duid.t covers the unit that writes it before
NetworkManager, and genesis_metadata.py covers the installed files.

All 15 assertions fail on this commit: there is no genesis-duid script and no unit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 17:51:45 -03:00

58 lines
2.1 KiB
Perl

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Test::More;
use XCAT::Test::File qw(repo_path slurp_repo_file);
# The systemd unit and the recipe are the artifact. genesis-duid is shell and is tested in
# xCAT-test/bats/genesis_openembedded_duid.bats.
my $META = 'xCAT-genesis-base/oe/meta-xcat-genesis';
my $NETWORK = "$META/recipes-connectivity/xcat-genesis-network";
#---
# =head3 contents_of
#
# Descriptions: Read a repository file, or return an empty string when it is absent.
#
# Arguments:
# $relative - the path of the file, relative to the checkout
#
# Returns: the contents of the file, or an empty string
#
# A missing file has to fail each assertion that names it. slurp_repo_file dies instead,
# which names no assertion at all.
#---
sub contents_of {
my ($relative) = @_;
return -f repo_path($relative) ? slurp_repo_file($relative) : '';
}
my $service_contents = contents_of("$NETWORK/files/xcat-genesis-duid.service");
like( $service_contents, qr/^ConditionKernelCommandLine=xcatd$/m,
'the client identifier service requires a Genesis boot' );
like( $service_contents, qr/^Before=.*\bNetworkManager\.service\b/m,
'the client identifier is written before NetworkManager reads conf.d' );
like( $service_contents, qr/^Before=.*\bxcat-genesis-network-state\.service\b/m,
'the client identifier is written before management network selection' );
like( $service_contents, qr{^ExecStart=/usr/libexec/xcat/genesis-duid$}m,
'the service runs the client identifier script' );
like( $service_contents, qr/^Type=oneshot$/m,
'the client identifier is written once per boot' );
my $recipe_contents = contents_of("$NETWORK/xcat-genesis-network_1.0.bb");
like( $recipe_contents, qr/^SYSTEMD_SERVICE:\$\{PN\} = "xcat-genesis-duid\.service"$/m,
'the recipe enables the client identifier service' );
like( $recipe_contents, qr{\$\{D\}\$\{libexecdir\}/xcat/genesis-duid$}m,
'the recipe installs the client identifier script' );
ok( -f repo_path("$NETWORK/files/genesis-duid"),
'the client identifier script is in the OpenEmbedded layer' );
done_testing();