-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redfishpower: support setplugs configuration #157
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be helpful to develop a sharness test that runs
redfishpower
standalone rather than through powerman? This test seems awfully complicated just to check that setplugs works, and presumably we'll eventually have a dev script that uses all the new features in test (like the one I proposed).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the main reason I ran through powerman is b/c there isn't a facility to run
redfishpower
somewhat independently of powerman at the moment.For the time being, I'll splice out the "redfishpower" specific tests into a new file, rather than keep it within the "redfish" set of tests. Since they are clearly of a different beast than the device files in /etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably I'm oversimplifying again :-)
I was vaguely thinking you could write a sharness test that drove
redfishpower
with a here-is document in a sharness script but maybe that's not practical.