From cc2f173ca3a368d6677a8a5e3773e0fa50e42c8b Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 26 Aug 2014 14:28:35 +0200 Subject: [PATCH] run: support Intel AMT wsman protocol The older SOAP EOI protocol is not supported with AMT version 9+. By default the wsman tool will be used if installed. RUN_OPT examples to enforce amtool or wsman: --target amt --amt-tool wsman --target amt --amt-tool amttool Fixes #1251 --- tool/run | 81 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/tool/run b/tool/run index d2f168f0e..9df16f38e 100755 --- a/tool/run +++ b/tool/run @@ -617,7 +617,7 @@ proc is_amt_available { } { if {[info exists ::env(AMT_TEST_MACHINE_IP)] && [info exists ::env(AMT_TEST_MACHINE_PWD)] && [have_installed amtterm] && - [have_installed amttool]} { + [expr [have_installed amttool] || [have_installed wsman] ] } { return true } puts "No support for Intel's AMT detected." @@ -638,24 +638,17 @@ proc is_serial_available { } { ## -# Execute scenario using Intel's AMT +# Reset via Intel AMT (works up to version smaller Intel AMT 9) # -proc spawn_amt { wait_for_re timeout_value } { - global spawn_id - - if {![is_amt_available]} { return 0 } +proc amt_reset_soap_eoi { } { + set timeout 20 + set exit_result 1 # # amttool expects in the environment variable AMT_PASSWORD the password # set ::env(AMT_PASSWORD) $::env(AMT_TEST_MACHINE_PWD) - # - # reset the box - # - set timeout 20 - set exit_result 1 - while { $exit_result != 0 } { set try_again 0 set time_start [ clock seconds ] @@ -686,6 +679,70 @@ proc spawn_amt { wait_for_re timeout_value } { set exit_result [lindex $result 3] } +} + + +## +# Reset via Intel AMT wsman protocol +# +proc amt_reset_wsman { } { + file tempfile xml_request ".xml" + + set fh [open $xml_request "WRONLY"] + + puts $fh { + + + 5 + + http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous + + http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem + + CIM_ComputerSystem + ManagedSystem + + + + + } + + close $fh + + exec wsman invoke -a RequestPowerStateChange -J $xml_request "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService?SystemCreationClassName=\"CIM_ComputerSystem\",SystemName=\"Intel(r) AMT\",CreationClassName=\"CIM_PowerManagementService\",Name=\"Intel(r) AMT Power Management Service\"" --port 16992 -h $::env(AMT_TEST_MACHINE_IP) --username admin -p $::env(AMT_TEST_MACHINE_PWD) -V -v + + file delete $xml_request +} + + +## +# Execute scenario using Intel's AMT +# +proc spawn_amt { wait_for_re timeout_value } { + global spawn_id + + if {![is_amt_available]} { return 0 } + + # + # amttool and wsman are supported for reset + # + set amt_tool [get_cmd_arg --amt-tool "default"] + + # + # reset the box + # + if {[have_installed wsman] && ( $amt_tool == "wsman" || $amt_tool == "default") } { + amt_reset_wsman + } else { + if {[have_installed amttool] && ($amt_tool == "amttool" || $amt_tool == "default") } { + amt_reset_soap_eoi + } else { + puts stderr "specified tool \"$amt_tool\" for using Intel AMT is unknown or is not installed" + exit -1 + } + } + sleep 5 #