-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from chu11/redfishpower_setplugs
redfishpower: support setplugs configuration
- Loading branch information
Showing
6 changed files
with
275 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Variant of redfishpower-cray-r272z30.dev that covers use of setplugs | ||
# configuration | ||
specification "redfishpower-setplugs" { | ||
timeout 60 | ||
|
||
script login { | ||
expect "redfishpower> " | ||
send "auth USER:PASS\n" | ||
expect "redfishpower> " | ||
send "setheader Content-Type:application/json\n" | ||
expect "redfishpower> " | ||
send "setplugs Node[0-15] [0-15]\n" | ||
expect "redfishpower> " | ||
send "setstatpath redfish/v1/Systems/Self\n" | ||
expect "redfishpower> " | ||
send "setonpath redfish/v1/Systems/Self/Actions/ComputerSystem.Reset {\"ResetType\":\"On\"}\n" | ||
expect "redfishpower> " | ||
send "setoffpath redfish/v1/Systems/Self/Actions/ComputerSystem.Reset {\"ResetType\":\"ForceOff\"}\n" | ||
expect "redfishpower> " | ||
send "setcyclepath redfish/v1/Systems/Self/Actions/ComputerSystem.Reset {\"ResetType\":\"ForceRestart\"}\n" | ||
expect "redfishpower> " | ||
send "settimeout 60\n" | ||
expect "redfishpower> " | ||
} | ||
script logout { | ||
send "quit\n" | ||
} | ||
script status_all { | ||
send "stat\n" | ||
foreachnode { | ||
expect "([^\n:]+): ([^\n]+\n)" | ||
setplugstate $1 $2 on="^on\n" off="^off\n" | ||
} | ||
expect "redfishpower> " | ||
} | ||
script on_ranged { | ||
send "on %s\n" | ||
expect "redfishpower> " | ||
} | ||
script off_ranged { | ||
send "off %s\n" | ||
expect "redfishpower> " | ||
} | ||
script cycle_ranged { | ||
send "cycle %s\n" | ||
expect "redfishpower> " | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/sh | ||
|
||
test_description='Cover redfishpower specific configurations' | ||
|
||
. `dirname $0`/sharness.sh | ||
|
||
powermand=$SHARNESS_BUILD_DIRECTORY/src/powerman/powermand | ||
powerman=$SHARNESS_BUILD_DIRECTORY/src/powerman/powerman | ||
redfishdir=$SHARNESS_BUILD_DIRECTORY/src/redfishpower | ||
devicesdir=$SHARNESS_TEST_SRCDIR/../etc/devices | ||
testdevicesdir=$SHARNESS_TEST_SRCDIR/etc | ||
|
||
# Use port = 11000 + test number | ||
# That way there won't be port conflicts with make -j | ||
testaddr=localhost:11034 | ||
|
||
|
||
makeoutput() { | ||
printf "on: %s\n" $1 | ||
printf "off: %s\n" $2 | ||
printf "unknown: %s\n" $3 | ||
} | ||
|
||
# | ||
# redfishpower fail hosts coverage | ||
# | ||
|
||
test_expect_success 'create powerman.conf for 16 cray redfish nodes (failhosts)' ' | ||
cat >powerman_fail_hosts.conf <<-EOT | ||
listen "$testaddr" | ||
include "$devicesdir/redfishpower-cray-r272z30.dev" | ||
device "d0" "redfishpower-cray-r272z30" "$redfishdir/redfishpower -h t[0-15] --test-mode --test-fail-power-cmd-hosts=t[8-15] |&" | ||
node "t[0-15]" "d0" | ||
EOT | ||
' | ||
test_expect_success 'start powerman daemon and wait for it to start (failhosts)' ' | ||
$powermand -Y -c powerman_fail_hosts.conf & | ||
echo $! >powermand.pid && | ||
$powerman --retry-connect=100 --server-host=$testaddr -d | ||
' | ||
test_expect_success 'powerman -q shows t[0-7] off, t[8-15] unknown' ' | ||
$powerman -h $testaddr -q >test_failhosts_query.out && | ||
makeoutput "" "t[0-7]" "t[8-15]" >test_failhosts_query.exp && | ||
test_cmp test_failhosts_query.exp test_failhosts_query.out | ||
' | ||
test_expect_success 'powerman -1 t[0-15] completes' ' | ||
$powerman -h $testaddr -1 t[0-15] >test_failhosts_on.out && | ||
echo Command completed successfully >test_failhosts_on.exp && | ||
test_cmp test_failhosts_on.exp test_failhosts_on.out | ||
' | ||
test_expect_success 'powerman -q shows t[0-7] on' ' | ||
$powerman -h $testaddr -q >test_failhosts_query2.out && | ||
makeoutput "t[0-7]" "" "t[8-15]" >test_failhosts_query2.exp && | ||
test_cmp test_failhosts_query2.exp test_failhosts_query2.out | ||
' | ||
test_expect_success 'stop powerman daemon (failhosts)' ' | ||
kill -15 $(cat powermand.pid) && | ||
wait | ||
' | ||
|
||
# | ||
# redfishpower setplugs coverage | ||
# | ||
|
||
test_expect_success 'create powerman.conf for 16 cray redfish nodes (setplugs)' ' | ||
cat >powerman_setplugs.conf <<-EOT | ||
listen "$testaddr" | ||
include "$testdevicesdir/redfishpower-setplugs.dev" | ||
device "d0" "redfishpower-setplugs" "$redfishdir/redfishpower -h t[0-15] --test-mode |&" | ||
node "t[0-15]" "d0" "Node[0-15]" | ||
EOT | ||
' | ||
test_expect_success 'start powerman daemon and wait for it to start (setplugs)' ' | ||
$powermand -Y -c powerman_setplugs.conf & | ||
echo $! >powermand.pid && | ||
$powerman --retry-connect=100 --server-host=$testaddr -d | ||
' | ||
test_expect_success 'powerman -q shows all off' ' | ||
$powerman -h $testaddr -q >test_setplugs_query.out && | ||
makeoutput "" "t[0-15]" "" >test_setplugs_query.exp && | ||
test_cmp test_setplugs_query.exp test_setplugs_query.out | ||
' | ||
test_expect_success 'powerman -T -q shows plugs are being used' ' | ||
$powerman -h $testaddr -T -q > test_setplugs_query_T.out && | ||
grep "Node15: off" test_setplugs_query_T.out | ||
' | ||
test_expect_success 'powerman -1 t[0-15] works' ' | ||
$powerman -h $testaddr -1 t[0-15] >test_setplugs_on.out && | ||
echo Command completed successfully >test_setplugs_on.exp && | ||
test_cmp test_setplugs_on.exp test_setplugs_on.out | ||
' | ||
test_expect_success 'powerman -q shows all on' ' | ||
$powerman -h $testaddr -q >test_setplugs_query2.out && | ||
makeoutput "t[0-15]" "" "" >test_setplugs_query2.exp && | ||
test_cmp test_setplugs_query2.exp test_setplugs_query2.out | ||
' | ||
test_expect_success 'stop powerman daemon (setplugs)' ' | ||
kill -15 $(cat powermand.pid) && | ||
wait | ||
' | ||
|
||
test_done | ||
|
||
# vi: set ft=sh |