2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-23 19:02:17 +00:00

test(xcat-core): an installed KVM node sends a DUID its reservation does not hold

makedhcp applies the firmware and canonical policies of mac.duid to
vpd.uuid. configdhcpv6duid applies them to product_uuid of the node. A
KVM domain that an earlier mkvm defined holds the byte swap of
vpd.uuid, so in that guest product_uuid is the swap. With duid=canonical
the installed DHCPv6 client then sends the firmware order, and matches
no reservation.

postscript_dhcpv6_duid.bats gives the script a vpd.uuid in VPDUUID and
a product_uuid that is its swap, and asserts the DUID that makedhcp
reserves for each policy. It also asserts that mypostscript exports
VPDUUID. The five tests fail on this tree.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-11-09 18:19:00 -03:00
parent b62fd4cc8a
commit d91dc332d9
+46 -1
View File
@@ -26,7 +26,7 @@ setup()
export XCAT_NM_CONF_DIR="$BATS_TEST_TMPDIR/nm"
export XCAT_NETWORKD_CONF_DIR="$BATS_TEST_TMPDIR/nd"
export XCAT_TEST_LOG="$BATS_TEST_TMPDIR/commands.log"
unset DHCP6DUID MACMAC ARCH
unset DHCP6DUID MACMAC ARCH VPDUUID
: >"$XCAT_TEST_LOG"
mkdir -p "$XCAT_NM_CONF_DIR" "$XCAT_NETWORKD_CONF_DIR"
}
@@ -285,3 +285,48 @@ DUIDRawData=00:01:52:54:00:aa:bb:cc" ]
[ ! -e "$XCAT_NETWORKD_CONF_DIR/15-xcat-dhcpv6-duid.conf" ]
grep -q 'is not firmware, canonical, ll, or a DUID' "$XCAT_TEST_LOG"
}
# ---- the UUID policies read vpd.uuid, as makedhcp does ------------------------------------
# makedhcp applies firmware and canonical to vpd.uuid. A KVM domain that an earlier mkvm defined
# holds the byte swap of vpd.uuid, so product_uuid in the guest is that swap, and a policy applied
# to product_uuid gives the other order. mypostscript exports vpd.uuid as VPDUUID.
@test "canonical applies to vpd.uuid when product_uuid is its byte swap" {
export DHCP6DUID=canonical VPDUUID=00112233-4455-6677-8899-aabbccddeeff
run_duid 33221100-5544-7766-8899-aabbccddeeff
[ "$status" -eq 0 ]
[ "$(nm_file | sed -n 's/^ipv6.dhcp-duid=//p')" = "$CANONICAL" ]
}
@test "firmware applies to vpd.uuid when product_uuid is its byte swap" {
export DHCP6DUID=firmware VPDUUID=00112233-4455-6677-8899-aabbccddeeff
run_duid 33221100-5544-7766-8899-aabbccddeeff
[ "$status" -eq 0 ]
[ "$(nm_file | sed -n 's/^ipv6.dhcp-duid=//p')" = "$DUID" ]
}
@test "the unset attribute applies the firmware order to vpd.uuid too" {
export VPDUUID=00112233-4455-6677-8899-aabbccddeeff
run_duid 33221100-5544-7766-8899-aabbccddeeff
[ "$status" -eq 0 ]
[ "$(nm_file | sed -n 's/^ipv6.dhcp-duid=//p')" = "$DUID" ]
}
@test "vpd.uuid is read without a SMBIOS UUID on the node" {
export DHCP6DUID=canonical VPDUUID=00112233-4455-6677-8899-AABBCCDDEEFF
rm -f "$XCAT_PRODUCT_UUID_FILE"
run /bin/bash "$SCRIPT"
[ "$status" -eq 0 ]
[ "$(nm_file | sed -n 's/^ipv6.dhcp-duid=//p')" = "$CANONICAL" ]
}
@test "mypostscript exports VPDUUID to the postscripts it runs" {
tmpl="$(repo_path 'xCAT-server/share/xcat/mypostscript/mypostscript.tmpl')"
rendered="$BATS_TEST_TMPDIR/mypostscript"
sed -e '/^tabdump(/d' \
-e 's/#TABLE:\([^:]*\):\$NODE:\([^#]*\)#/\1.\2/g' \
-e 's/=#[A-Z_]*#/=/g' "$tmpl" >"$rendered"
run /bin/bash -c '. "$1" && /bin/bash -c "printf %s \"\${VPDUUID-unset}\""' _ "$rendered"
[ "$status" -eq 0 ]
[ "$output" = "vpd.uuid" ]
}