Skip to content

Commit

Permalink
t: cover redfishpower parent/hierarchy support
Browse files Browse the repository at this point in the history
Problem: There is no coverage for the new redfishpower parent/hierarchy
support.

Add coverage in t0034-redfishpower.t and add test device files
t/etc/redfishpower-parents-2-levels.dev and
t/etc/redfishpower-parents-3-levels.dev.
  • Loading branch information
chu11 committed Mar 26, 2024
1 parent e8a7b68 commit fddf7f2
Show file tree
Hide file tree
Showing 4 changed files with 484 additions and 1 deletion.
4 changes: 3 additions & 1 deletion t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ EXTRA_DIST= \
etc/redfishpower-setplugs.dev \
etc/redfishpower-setpath.dev \
etc/redfishpower-plugsub.dev \
etc/redfishpower-plugsub-blades.dev
etc/redfishpower-plugsub-blades.dev \
etc/redfishpower-parents-2-levels.dev \
etc/redfishpower-parents-3-levels.dev


AM_CFLAGS = @WARNING_CFLAGS@
Expand Down
50 changes: 50 additions & 0 deletions t/etc/redfishpower-parents-2-levels.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Variant of redfishpower-cray-r272z30.dev that covers use of setplugs
# configuration with a parent. Node0 is the parent of Node[1-15]
specification "redfishpower-parents-2-levels" {
timeout 60

script login {
expect "redfishpower> "
send "auth USER:PASS\n"
expect "redfishpower> "
send "setheader Content-Type:application/json\n"
expect "redfishpower> "
send "setplugs Node0 0\n"
expect "redfishpower> "
send "setplugs Node[1-15] [1-15] Node0\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> "
}
}
60 changes: 60 additions & 0 deletions t/etc/redfishpower-parents-3-levels.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Variant of redfishpower-cray-r272z30.dev that covers use of setplugs
# configuration with parents.
# Node0 is the parent of Node[1-3]
# Node1 is the parent of Node[4-7]
# Node2 is the parent of Node[8-11]
# Node3 is the parent of Node[12-15]
specification "redfishpower-parents-3-levels" {
timeout 60

script login {
expect "redfishpower> "
send "auth USER:PASS\n"
expect "redfishpower> "
send "setheader Content-Type:application/json\n"
expect "redfishpower> "
send "setplugs Node0 0\n"
expect "redfishpower> "
send "setplugs Node[1-3] [1-3] Node0\n"
expect "redfishpower> "
send "setplugs Node[4-7] [4-7] Node1\n"
expect "redfishpower> "
send "setplugs Node[8-11] [8-11] Node2\n"
expect "redfishpower> "
send "setplugs Node[12-15] [12-15] Node3\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> "
}
}
Loading

0 comments on commit fddf7f2

Please sign in to comment.