2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-12-04 08:07:04 +00:00

fix(xcat-core): test that bmcsetup reports BMC status to an invalid IPv6 host

On an IPv6 cluster, bmcsetup in Genesis sends the bmcready status to
"[2001" instead of the management node. An OpenBMC node also reports
"failed" after its IPv6 address is set correctly.

The new tests run bmcsetup with xcatd=[2001:db8::1]:3001 on the kernel
command line and XCATMASTER in the environment, as doxcat starts it.
They record the host that updateflag.awk and allowcred.awk receive. The
OpenBMC tests supply the lan6 print output of the BMC. The IPv6 tests
fail on this commit. The IPv4 tests pass.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-11-10 17:38:11 -03:00
parent a8b81b7f76
commit d2b97cc17b
+79 -1
View File
@@ -51,6 +51,7 @@ case "$1 $2" in
'lan6 set')
[ ! -f /run/fixture/lan6-fails ] || exit 1
;;
'lan6 print') cat "/run/fixture/lan6.$device" 2>/dev/null ;;
'channel getaccess') echo 'Fixed Name : No' ;;
'user list') cat /run/fixture/users ;;
'user disable') printf '%s\n' "$3" >>/run/fixture/disabled ;;
@@ -83,9 +84,17 @@ else
fi
SH
local utility
for utility in modprobe updateflag.awk remoteimmsetup allowcred.awk; do
for utility in modprobe remoteimmsetup; do
printf '#!/bin/sh\nexit 0\n' >"$fixture/bin/$utility"
done
cat >"$fixture/bin/updateflag.awk" <<'SH'
#!/bin/sh
printf '%s\n' "$*" >>/run/fixture/flags
SH
cat >"$fixture/bin/allowcred.awk" <<'SH'
#!/bin/sh
printf '%s\n' "$XCATMASTER" >>/run/fixture/allowcred
SH
cat >"$fixture/bin/sleep" <<'SH'
#!/bin/sh
printf '%s\n' "$*" >>/run/fixture/sleeps
@@ -402,3 +411,72 @@ XML
grep -F 'ipmitool lan6 set 1 static_addr 0 enable 2001:db8:1::20 64 failed' "$fixture/messages"
grep -Fx -- '-d 0 user enable 2' "$fixture/calls"
}
# doxcat starts bmcsetup with XCATMASTER already exported. bmcsetup reads the
# address from the xcatd= kernel argument again.
doxcat_master()
{
echo "BOOTIF=01-52-54-00-00-00-01 xcatd=$1" >"$fixture/cmdline"
sandbox+=(--setenv XCATMASTER "$2")
}
@test 'bmcsetup reports BMC status to an IPv6 xcatd' {
ipv6_config
doxcat_master '[2001:db8::1]:3001' '2001:db8::1'
run_genesis 0
run cat "$fixture/flags"
[ "$output" = '2001:db8::1 3002 installstatus bmcready' ]
run cat "$fixture/allowcred"
[ "$output" = '2001:db8::1' ]
}
@test 'bmcsetup reports BMC status to an IPv4 xcatd' {
doxcat_master '192.0.2.1:3001' '192.0.2.1'
run_genesis 0
run cat "$fixture/flags"
[ "$output" = '192.0.2.1 3002 installstatus bmcready' ]
run cat "$fixture/allowcred"
[ "$output" = '192.0.2.1' ]
}
openbmc()
{
printf '%s\n' 'IPMI Version : 2.0' 'Manufacturer ID : 42817' 'Product ID : 16975' >"$fixture/mcinfo"
}
@test 'bmcsetup reports an OpenBMC ready when it reads back its IPv6 address' {
openbmc
ipv6_config
cat >"$fixture/lan6.0" <<'LAN'
IPv6 Static Address 0:
Enabled: yes
Address: 2001:db8:1::20/64
Status: active
LAN
doxcat_master '[2001:db8::1]:3001' '2001:db8::1'
run_genesis 0
run cat "$fixture/flags"
[ "$output" = '2001:db8::1 3002 installstatus bmcready' ]
}
@test 'bmcsetup reports an OpenBMC failed when its IPv6 address does not read back' {
openbmc
ipv6_config
cat >"$fixture/lan6.0" <<'LAN'
IPv6 Static Address 0:
Enabled: no
Address: ::/0
LAN
doxcat_master '[2001:db8::1]:3001' '2001:db8::1'
run_genesis 0
run cat "$fixture/flags"
[ "$output" = '2001:db8::1 3002 installstatus failed' ]
}
@test 'bmcsetup reports an OpenBMC ready when it reads back its IPv4 address' {
openbmc
doxcat_master '192.0.2.1:3001' '192.0.2.1'
run_genesis 0
run cat "$fixture/flags"
[ "$output" = '192.0.2.1 3002 installstatus bmcready' ]
}