xref: /openbmc/openbmc-test-automation/lib/ipmi_client.robot (revision 5e870cd25b19cb15aaf119f1646a7ee573fcc616)
1*** Settings ***
2Documentation   This module is for IPMI client for copying ipmitool to
3...             openbmc box and execute ipmitool commands.
4
5Resource        ../lib/resource.txt
6Resource        ../lib/connection_client.robot
7
8*** Keywords ***
9Run IPMI Command
10    [arguments]    ${args}
11    Copy ipmitool
12    ${output}   ${stderr}=  Execute Command    /tmp/ipmitool -I dbus raw ${args}  return_stderr=True
13    Should Be Empty 	${stderr}
14    set test variable    ${OUTPUT}     "${output}"
15
16Run IPMI Standard Command
17    [arguments]    ${args}
18    Copy ipmitool
19    ${stdout}    ${stderr}    ${output}=  Execute Command    /tmp/ipmitool -I dbus ${args}    return_stdout=True    return_stderr= True    return_rc=True
20    Should Be Equal    ${output}    ${0}    msg=${stderr}
21    [return]    ${stdout}
22
23Copy ipmitool
24    OperatingSystem.File Should Exist   tools/ipmitool      msg=The ipmitool program could not be found in the tools directory. It is not part of the automation code by default. You must manually copy or link the correct openbmc version of the tool in to the tools directory in order to run this test suite.
25
26    Import Library      SCPLibrary      WITH NAME       scp
27    scp.Open connection     ${OPENBMC_HOST}     username=${OPENBMC_USERNAME}      password=${OPENBMC_PASSWORD}
28    scp.Put File    tools/ipmitool   /tmp
29    SSHLibrary.Open Connection     ${OPENBMC_HOST}
30    Login   ${OPENBMC_USERNAME}    ${OPENBMC_PASSWORD}
31    Execute Command     chmod +x /tmp/ipmitool
32