xref: /openbmc/openbmc-test-automation/lib/ipmi_client.robot (revision 9a08944d792859d2ea332cac75f01a0533f58020)
1b29d2e84SChris Austen*** Settings ***
2b29d2e84SChris AustenDocumentation   This module is for IPMI client for copying ipmitool to
3a2dab3c8SSivas SRR...             openbmc box and execute ipmitool IPMI standard
4a2dab3c8SSivas SRR...             command. IPMI raw command will use dbus-send command
5b29d2e84SChris AustenResource        ../lib/resource.txt
64d6c1dabSGeorge KeishingResource        ../lib/connection_client.robot
7ae7c2281SPrashanth KattiResource        ../lib/utils.robot
8ae7c2281SPrashanth KattiResource        ../lib/state_manager.robot
9ae7c2281SPrashanth Katti
10a2dab3c8SSivas SRRLibrary         String
1119621bacSMichael WalshLibrary         ipmi_client.py
12a2dab3c8SSivas SRR
13a2dab3c8SSivas SRR*** Variables ***
14d7f11f70SGeorge Keishing${dbusHostIpmicmd1}=   dbus-send --system  ${OPENBMC_BASE_URI}HostIpmi/1
15d7f11f70SGeorge Keishing${dbusHostIpmiCmdReceivedMsg}=   ${OPENBMC_BASE_DBUS}.HostIpmi.ReceivedMessage
16a2dab3c8SSivas SRR${netfnByte}=          ${EMPTY}
17a2dab3c8SSivas SRR${cmdByte}=            ${EMPTY}
18a2dab3c8SSivas SRR${arrayByte}=          array:byte:
1919621bacSMichael Walsh${IPMI_EXT_CMD}        ${EMPTY}
20a7913898SMichael Walsh${IPMI_USER_OPTIONS}   ${EMPTY}
2139967ebcSGeorge Keishing${IPMI_INBAND_CMD}=    ipmitool -C ${IPMI_CIPHER_LEVEL}
227a212a09SRahul Maheshwari${HOST}=               -H
237a212a09SRahul Maheshwari${RAW}=                raw
24b29d2e84SChris Austen
25b29d2e84SChris Austen*** Keywords ***
267a212a09SRahul Maheshwari
27b29d2e84SChris AustenRun IPMI Command
28f4a807bfSJoy Onyerikwu    [Documentation]  Run the given IPMI command.
2938032805SGunnar Mills    [Arguments]  ${args}
307a212a09SRahul Maheshwari    ${resp}=  Run Keyword If  '${IPMI_COMMAND}' == 'External'
31b4d4a4aeSGeorge Keishing    ...  Run External IPMI Raw Command  ${args}
32ae7c2281SPrashanth Katti    ...  ELSE IF  '${IPMI_COMMAND}' == 'Inband'
33b4d4a4aeSGeorge Keishing    ...  Run Inband IPMI Raw Command  ${args}
347a212a09SRahul Maheshwari    ...  ELSE IF  '${IPMI_COMMAND}' == 'Dbus'
357a212a09SRahul Maheshwari    ...  Run Dbus IPMI RAW Command  ${args}
36ae7c2281SPrashanth Katti    ...  ELSE  Fail  msg=Invalid IPMI Command type provided : ${IPMI_COMMAND}
37c9ea9368SGunnar Mills    [Return]  ${resp}
387a212a09SRahul Maheshwari
397a212a09SRahul MaheshwariRun IPMI Standard Command
40f4a807bfSJoy Onyerikwu    [Documentation]  Run the standard IPMI command.
4138032805SGunnar Mills    [Arguments]  ${args}
427a212a09SRahul Maheshwari    ${resp}=  Run Keyword If  '${IPMI_COMMAND}' == 'External'
437a212a09SRahul Maheshwari    ...  Run External IPMI Standard Command  ${args}
44ae7c2281SPrashanth Katti    ...  ELSE IF  '${IPMI_COMMAND}' == 'Inband'
45ae7c2281SPrashanth Katti    ...  Run Inband IPMI Standard Command  ${args}
467a212a09SRahul Maheshwari    ...  ELSE IF  '${IPMI_COMMAND}' == 'Dbus'
477a212a09SRahul Maheshwari    ...  Run Dbus IPMI Standard Command  ${args}
48ae7c2281SPrashanth Katti    ...  ELSE  Fail  msg=Invalid IPMI Command type provided : ${IPMI_COMMAND}
497a212a09SRahul Maheshwari
50c9ea9368SGunnar Mills    [Return]  ${resp}
517a212a09SRahul Maheshwari
527a212a09SRahul MaheshwariRun Dbus IPMI RAW Command
53f4a807bfSJoy Onyerikwu    [Documentation]  Run the raw IPMI command through dbus.
5438032805SGunnar Mills    [Arguments]    ${args}
55a2dab3c8SSivas SRR    ${valueinBytes}=   Byte Conversion  ${args}
56a2dab3c8SSivas SRR    ${cmd}=   Catenate   ${dbushostipmicmd1} ${dbusHostIpmiCmdReceivedMsg}
57a2dab3c8SSivas SRR    ${cmd}=   Catenate   ${cmd} ${valueinBytes}
58a2dab3c8SSivas SRR    ${output}   ${stderr}=  Execute Command  ${cmd}  return_stderr=True
59b29d2e84SChris Austen    Should Be Empty      ${stderr}
60b29d2e84SChris Austen    set test variable    ${OUTPUT}     "${output}"
61b29d2e84SChris Austen
627a212a09SRahul MaheshwariRun Dbus IPMI Standard Command
63f4a807bfSJoy Onyerikwu    [Documentation]  Run the standard IPMI command through dbus.
6438032805SGunnar Mills    [Arguments]    ${args}
654d6c1dabSGeorge Keishing    Copy ipmitool
667a212a09SRahul Maheshwari    ${stdout}    ${stderr}    ${output}=  Execute Command
677a212a09SRahul Maheshwari    ...    /tmp/ipmitool -I dbus ${args}    return_stdout=True
687a212a09SRahul Maheshwari    ...    return_stderr= True    return_rc=True
69b29d2e84SChris Austen    Should Be Equal    ${output}    ${0}    msg=${stderr}
70c9ea9368SGunnar Mills    [Return]    ${stdout}
71b29d2e84SChris Austen
72ae7c2281SPrashanth KattiRun Inband IPMI Raw Command
73f4a807bfSJoy Onyerikwu    [Documentation]  Run the raw IPMI command in-band.
74ae7c2281SPrashanth Katti    [Arguments]  ${args}  ${os_host}=${OS_HOST}  ${os_username}=${OS_USERNAME}
75ae7c2281SPrashanth Katti    ...          ${os_password}=${OS_PASSWORD}
76ae7c2281SPrashanth Katti
7728e403b8SGunnar Mills    # Description of arguments:
78ae7c2281SPrashanth Katti    # ${args}  parameters to IPMI command.
79ae7c2281SPrashanth Katti    # ${os_host} IP address of the OS Host.
80ae7c2281SPrashanth Katti    # ${os_username}  OS Host Login user name.
81ae7c2281SPrashanth Katti    # ${os_password}  OS Host Login passwrd.
82ae7c2281SPrashanth Katti
83ae7c2281SPrashanth Katti    Login To OS Host  ${os_host}  ${os_username}  ${os_password}
84ae7c2281SPrashanth Katti    Check If IPMI Tool Exist
85ae7c2281SPrashanth Katti
86ae7c2281SPrashanth Katti    ${inband_raw_cmd}=  Catenate  ${IPMI_INBAND_CMD}  ${RAW}  ${args}
87ae7c2281SPrashanth Katti    ${stdout}  ${stderr}=  Execute Command  ${inband_raw_cmd}  return_stderr=True
88ae7c2281SPrashanth Katti    Should Be Empty  ${stderr}  msg=${stdout}
89ae7c2281SPrashanth Katti    [Return]  ${stdout}
90ae7c2281SPrashanth Katti
91ae7c2281SPrashanth KattiRun Inband IPMI Standard Command
92f4a807bfSJoy Onyerikwu    [Documentation]  Run the standard IPMI command in-band.
93ae7c2281SPrashanth Katti    [Arguments]  ${args}  ${os_host}=${OS_HOST}  ${os_username}=${OS_USERNAME}
94ae7c2281SPrashanth Katti    ...          ${os_password}=${OS_PASSWORD}
95ae7c2281SPrashanth Katti
9628e403b8SGunnar Mills    # Description of arguments:
97ae7c2281SPrashanth Katti    # ${args}  parameters to IPMI command.
98ae7c2281SPrashanth Katti    # ${os_host} IP address of the OS Host.
99ae7c2281SPrashanth Katti    # ${os_username}  OS Host Login user name.
100ae7c2281SPrashanth Katti    # ${os_password}  OS Host Login passwrd.
101ae7c2281SPrashanth Katti
102ae7c2281SPrashanth Katti    Login To OS Host  ${os_host}  ${os_username}  ${os_password}
103ae7c2281SPrashanth Katti    Check If IPMI Tool Exist
104ae7c2281SPrashanth Katti
105ae7c2281SPrashanth Katti    ${inband_std_cmd}=  Catenate  ${IPMI_INBAND_CMD}  ${args}
106ae7c2281SPrashanth Katti    ${stdout}  ${stderr}=  Execute Command  ${inband_std_cmd}  return_stderr=True
107ae7c2281SPrashanth Katti    Should Be Empty  ${stderr}  msg=${stdout}
108ae7c2281SPrashanth Katti    [Return]  ${stdout}
109ae7c2281SPrashanth Katti
110b4d4a4aeSGeorge KeishingRun External IPMI Raw Command
111f4a807bfSJoy Onyerikwu    [Documentation]  Run the raw IPMI command externally.
11238032805SGunnar Mills    [Arguments]    ${args}
11319621bacSMichael Walsh
1147a212a09SRahul Maheshwari    ${ipmi_raw_cmd}=   Catenate  SEPARATOR=
115a7913898SMichael Walsh    ...    ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE}
1167a212a09SRahul Maheshwari    ...    ${HOST}${SPACE}${OPENBMC_HOST}${SPACE}${RAW}${SPACE}${args}
1177a212a09SRahul Maheshwari    ${rc}    ${output}=    Run and Return RC and Output    ${ipmi_raw_cmd}
1187a212a09SRahul Maheshwari    Should Be Equal    ${rc}    ${0}    msg=${output}
119c9ea9368SGunnar Mills    [Return]    ${output}
1207a212a09SRahul Maheshwari
1217a212a09SRahul MaheshwariRun External IPMI Standard Command
122f4a807bfSJoy Onyerikwu    [Documentation]  Run the standard IPMI command in-band.
12302651f0cSGeorge Keishing    [Arguments]  ${args}  ${fail_on_err}=${1}
12402651f0cSGeorge Keishing
12502651f0cSGeorge Keishing    # Description of argument(s):
12602651f0cSGeorge Keishing    # args         IPMI command to be executed.
12702651f0cSGeorge Keishing    # fail_on_err  Fail if keyword the IPMI command fails
128a7913898SMichael Walsh
1297a212a09SRahul Maheshwari    ${ipmi_cmd}=  Catenate  SEPARATOR=
130a7913898SMichael Walsh    ...  ${IPMI_EXT_CMD} ${IPMI_USER_OPTIONS} -P${SPACE}${IPMI_PASSWORD}
131a7913898SMichael Walsh    ...  ${SPACE}${HOST}${SPACE}${OPENBMC_HOST}${SPACE}${args}
13204a2204bSRahul Maheshwari    ${rc}  ${output}=  Run And Return RC and Output  ${ipmi_cmd}
13302651f0cSGeorge Keishing    Return From Keyword If  ${fail_on_err} == ${0}  ${output}
1347a212a09SRahul Maheshwari    Should Be Equal  ${rc}  ${0}  msg=${output}
135c9ea9368SGunnar Mills    [Return]  ${output}
1367a212a09SRahul Maheshwari
137ae7c2281SPrashanth KattiCheck If IPMI Tool Exist
138ae7c2281SPrashanth Katti    [Documentation]  Check if IPMI Tool installed or not.
139ae7c2281SPrashanth Katti    ${output}=  Execute Command  which ipmitool
140ae7c2281SPrashanth Katti    Should Not Be Empty  ${output}  msg=ipmitool not installed.
1417a212a09SRahul Maheshwari
14204a2204bSRahul Maheshwari
14304a2204bSRahul MaheshwariActivate SOL Via IPMI
14404a2204bSRahul Maheshwari    [Documentation]  Start SOL using IPMI and route output to a file.
14504a2204bSRahul Maheshwari    [Arguments]  ${file_path}=/tmp/sol_${OPENBMC_HOST}
14604a2204bSRahul Maheshwari    # Description of argument(s):
14704a2204bSRahul Maheshwari    # file_path  The file path on the local machine (vs OBMC) to collect SOL
14804a2204bSRahul Maheshwari    #            output. By default SOL output is collected at
14904a2204bSRahul Maheshwari    #            /tmp/sol_<BMC_IP> else user input location.
15004a2204bSRahul Maheshwari
15104a2204bSRahul Maheshwari    ${ipmi_cmd}=  Catenate  SEPARATOR=
152c8470881SRahul Maheshwari    ...  ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE}${HOST}
153c8470881SRahul Maheshwari    ...  ${SPACE}${OPENBMC_HOST}${SPACE}sol activate usesolkeepalive
15404a2204bSRahul Maheshwari
1552102f6bfSGeorge Keishing    Start Process  ${ipmi_cmd}  shell=True  stdout=${file_path}
1564f360843SRahul Maheshwari    ...  alias=sol_proc
15704a2204bSRahul Maheshwari
15804a2204bSRahul Maheshwari
15904a2204bSRahul MaheshwariDeactivate SOL Via IPMI
16004a2204bSRahul Maheshwari    [Documentation]  Stop SOL using IPMI and return SOL output.
16104a2204bSRahul Maheshwari    [Arguments]  ${file_path}=/tmp/sol_${OPENBMC_HOST}
16204a2204bSRahul Maheshwari    # Description of argument(s):
16304a2204bSRahul Maheshwari    # file_path  The file path on the local machine to copy SOL output
16404a2204bSRahul Maheshwari    #            collected by above "Activate SOL Via IPMI" keyword.
16504a2204bSRahul Maheshwari    #            By default it copies log from /tmp/sol_<BMC_IP>.
16604a2204bSRahul Maheshwari
16704a2204bSRahul Maheshwari    ${ipmi_cmd}=  Catenate  SEPARATOR=
16804a2204bSRahul Maheshwari    ...  ${IPMI_EXT_CMD} -P${SPACE}${IPMI_PASSWORD}${SPACE}
16904a2204bSRahul Maheshwari    ...  ${HOST}${SPACE}${OPENBMC_HOST}${SPACE}sol deactivate
17004a2204bSRahul Maheshwari
17104a2204bSRahul Maheshwari    ${rc}  ${output}=  Run and Return RC and Output  ${ipmi_cmd}
1724f360843SRahul Maheshwari    Run Keyword If  ${rc} > 0  Run Keywords
1737f48a2c6SRahul Maheshwari    ...  Run Keyword And Ignore Error  Terminate Process  sol_proc
1747f48a2c6SRahul Maheshwari    ...  AND  Return From Keyword  ${output}
17504a2204bSRahul Maheshwari
17604a2204bSRahul Maheshwari    ${rc}  ${output}=  Run and Return RC and Output  cat ${file_path}
17704a2204bSRahul Maheshwari    Should Be Equal  ${rc}  ${0}  msg=${output}
17804a2204bSRahul Maheshwari
17904a2204bSRahul Maheshwari    # Logging SOL output for debug purpose.
18004a2204bSRahul Maheshwari    Log  ${output}
18104a2204bSRahul Maheshwari
18204a2204bSRahul Maheshwari    [Return]  ${output}
18304a2204bSRahul Maheshwari
18404a2204bSRahul Maheshwari
185a2dab3c8SSivas SRRByte Conversion
186a2dab3c8SSivas SRR    [Documentation]   Byte Conversion method receives IPMI RAW commands as
187a2dab3c8SSivas SRR    ...               argument in string format.
188a2dab3c8SSivas SRR    ...               Sample argument is as follows
189a2dab3c8SSivas SRR    ...               "0x04 0x30 9 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00
190a2dab3c8SSivas SRR    ...               0x00"
191a2dab3c8SSivas SRR    ...               IPMI RAW command format is as follows
192a2dab3c8SSivas SRR    ...               <netfn Byte> <cmd Byte> <Data Bytes..>
193a2dab3c8SSivas SRR    ...               This method converts IPMI command format into
194a2dab3c8SSivas SRR    ...               dbus command format  as follows
195a2dab3c8SSivas SRR    ...               <byte:seq-id> <byte:netfn> <byte:lun> <byte:cmd>
196a2dab3c8SSivas SRR    ...               <array:byte:data>
197a2dab3c8SSivas SRR    ...               Sample dbus  Host IPMI Received Message argument
198a2dab3c8SSivas SRR    ...               byte:0x00 byte:0x04 byte:0x00 byte:0x30
199a2dab3c8SSivas SRR    ...               array:byte:9,0x01,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00
20038032805SGunnar Mills    [Arguments]     ${args}
201a2dab3c8SSivas SRR    ${argLength}=   Get Length  ${args}
202a2dab3c8SSivas SRR    Set Global Variable  ${arrayByte}   array:byte:
203a2dab3c8SSivas SRR    @{listargs}=   Split String  ${args}
204a2dab3c8SSivas SRR    ${index}=   Set Variable   ${0}
205*9a08944dSGeorge Keishing    :FOR  ${word}  IN  @{listargs}
206a2dab3c8SSivas SRR    \    Run Keyword if   ${index} == 0   Set NetFn Byte  ${word}
207a2dab3c8SSivas SRR    \    Run Keyword if   ${index} == 1   Set Cmd Byte    ${word}
208a2dab3c8SSivas SRR    \    Run Keyword if   ${index} > 1    Set Array Byte  ${word}
209a2dab3c8SSivas SRR    \    ${index}=    Set Variable    ${index + 1}
210a2dab3c8SSivas SRR    ${length}=   Get Length  ${arrayByte}
211a2dab3c8SSivas SRR    ${length}=   Evaluate  ${length} - 1
212a2dab3c8SSivas SRR    ${arrayByteLocal}=  Get Substring  ${arrayByte}  0   ${length}
213a2dab3c8SSivas SRR    Set Global Variable  ${arrayByte}   ${arrayByteLocal}
214a2dab3c8SSivas SRR    ${valueinBytesWithArray}=   Catenate  byte:0x00   ${netfnByte}  byte:0x00
215a2dab3c8SSivas SRR    ${valueinBytesWithArray}=   Catenate  ${valueinBytesWithArray}  ${cmdByte}
216a2dab3c8SSivas SRR    ${valueinBytesWithArray}=   Catenate  ${valueinBytesWithArray} ${arrayByte}
217a2dab3c8SSivas SRR    ${valueinBytesWithoutArray}=   Catenate  byte:0x00 ${netfnByte}  byte:0x00
218a2dab3c8SSivas SRR    ${valueinBytesWithoutArray}=   Catenate  ${valueinBytesWithoutArray} ${cmdByte}
219a2dab3c8SSivas SRR#   To Check scenario for smaller IPMI raw commands with only 2 arguments
220a2dab3c8SSivas SRR#   instead of usual 12 arguments.
221a2dab3c8SSivas SRR#   Sample small IPMI raw command: Run IPMI command 0x06 0x36
222a2dab3c8SSivas SRR#   If IPMI raw argument length is only 9 then return value in bytes without
223a2dab3c8SSivas SRR#   array population.
224a2dab3c8SSivas SRR#   Equivalent dbus-send argument for smaller IPMI raw command:
225a2dab3c8SSivas SRR#   byte:0x00 byte:0x06 byte:0x00 byte:0x36
226a2dab3c8SSivas SRR    Run Keyword if   ${argLength} == 9     Return from Keyword    ${valueinBytesWithoutArray}
227c9ea9368SGunnar Mills    [Return]    ${valueinBytesWithArray}
228a2dab3c8SSivas SRR
229a2dab3c8SSivas SRR
230a2dab3c8SSivas SRRSet NetFn Byte
231f4a807bfSJoy Onyerikwu    [Documentation]  Set the network function byte.
23238032805SGunnar Mills    [Arguments]    ${word}
233a2dab3c8SSivas SRR    ${netfnByteLocal}=  Catenate   byte:${word}
234a2dab3c8SSivas SRR    Set Global Variable  ${netfnByte}  ${netfnByteLocal}
235a2dab3c8SSivas SRR
236a2dab3c8SSivas SRRSet Cmd Byte
237f4a807bfSJoy Onyerikwu    [Documentation]  Set the command byte.
23838032805SGunnar Mills    [Arguments]    ${word}
239a2dab3c8SSivas SRR    ${cmdByteLocal}=  Catenate   byte:${word}
240a2dab3c8SSivas SRR    Set Global Variable  ${cmdByte}  ${cmdByteLocal}
241a2dab3c8SSivas SRR
242a2dab3c8SSivas SRRSet Array Byte
243f4a807bfSJoy Onyerikwu    [Documentation]  Set the array byte.
24438032805SGunnar Mills    [Arguments]    ${word}
245a2dab3c8SSivas SRR    ${arrayByteLocal}=   Catenate   SEPARATOR=  ${arrayByte}  ${word}
246a2dab3c8SSivas SRR    ${arrayByteLocal}=   Catenate   SEPARATOR=  ${arrayByteLocal}   ,
247a2dab3c8SSivas SRR    Set Global Variable  ${arrayByte}   ${arrayByteLocal}
248a2dab3c8SSivas SRR
249b29d2e84SChris AustenCopy ipmitool
250f4a807bfSJoy Onyerikwu    [Documentation]  Copy the ipmitool to the BMC.
251f4a807bfSJoy Onyerikwu    ${ipmitool_error}=  Catenate  The ipmitool program could not be found in the tools directory.
252f4a807bfSJoy Onyerikwu    ...  It is not part of the automation code by default. You must manually copy or link the correct openbmc
253f4a807bfSJoy Onyerikwu    ...  version of the tool in to the tools directory in order to run this test suite.
254f4a807bfSJoy Onyerikwu
255f4a807bfSJoy Onyerikwu    OperatingSystem.File Should Exist  tools/ipmitool  msg=${ipmitool_error}
256b29d2e84SChris Austen
257b29d2e84SChris Austen    Import Library      SCPLibrary      WITH NAME       scp
258b29d2e84SChris Austen    scp.Open connection     ${OPENBMC_HOST}     username=${OPENBMC_USERNAME}      password=${OPENBMC_PASSWORD}
259b29d2e84SChris Austen    scp.Put File    tools/ipmitool   /tmp
260b29d2e84SChris Austen    SSHLibrary.Open Connection     ${OPENBMC_HOST}
261b29d2e84SChris Austen    Login   ${OPENBMC_USERNAME}    ${OPENBMC_PASSWORD}
262b29d2e84SChris Austen    Execute Command     chmod +x /tmp/ipmitool
2630c34f69cSSridevi Ramesh
2640c34f69cSSridevi RameshInitiate Host Boot Via External IPMI
2650c34f69cSSridevi Ramesh    [Documentation]  Initiate host power on using external IPMI.
266982fee42SRahul Maheshwari    [Arguments]  ${wait}=${1}
267982fee42SRahul Maheshwari    # Description of argument(s):
268982fee42SRahul Maheshwari    # wait  Indicates that this keyword should wait for host running state.
269982fee42SRahul Maheshwari
2700c34f69cSSridevi Ramesh    ${output}=  Run External IPMI Standard Command  chassis power on
2710c34f69cSSridevi Ramesh    Should Not Contain  ${output}  Error
272982fee42SRahul Maheshwari
273982fee42SRahul Maheshwari    Run Keyword If  '${wait}' == '${0}'  Return From Keyword
274982fee42SRahul Maheshwari    Wait Until Keyword Succeeds  10 min  10 sec  Is Host Running
2750c34f69cSSridevi Ramesh
2760c34f69cSSridevi RameshInitiate Host PowerOff Via External IPMI
2770c34f69cSSridevi Ramesh    [Documentation]  Initiate host power off using external IPMI.
278982fee42SRahul Maheshwari    [Arguments]  ${wait}=${1}
279982fee42SRahul Maheshwari    # Description of argument(s):
280982fee42SRahul Maheshwari    # wait  Indicates that this keyword should wait for host off state.
281982fee42SRahul Maheshwari
2820c34f69cSSridevi Ramesh    ${output}=  Run External IPMI Standard Command  chassis power off
2830c34f69cSSridevi Ramesh    Should Not Contain  ${output}  Error
284982fee42SRahul Maheshwari
285982fee42SRahul Maheshwari    Run Keyword If  '${wait}' == '${0}'  Return From Keyword
286982fee42SRahul Maheshwari    Wait Until Keyword Succeeds  3 min  10 sec  Is Host Off
287982fee42SRahul Maheshwari
288982fee42SRahul MaheshwariGet Host State Via External IPMI
289982fee42SRahul Maheshwari    [Documentation]  Returns host state using external IPMI.
290982fee42SRahul Maheshwari
291982fee42SRahul Maheshwari    ${output}=  Run External IPMI Standard Command  chassis power status
292982fee42SRahul Maheshwari    Should Not Contain  ${output}  Error
293982fee42SRahul Maheshwari    ${output}=  Fetch From Right  ${output}  ${SPACE}
294982fee42SRahul Maheshwari
295982fee42SRahul Maheshwari    [Return]  ${output}
296b4d4a4aeSGeorge Keishing
297b4d4a4aeSGeorge Keishing
298b4d4a4aeSGeorge KeishingSet BMC Network From Host
299b4d4a4aeSGeorge Keishing    [Documentation]  Set BMC network from host.
300b4d4a4aeSGeorge Keishing    [Arguments]  ${nw_info}
301b4d4a4aeSGeorge Keishing
302b4d4a4aeSGeorge Keishing    # Description of argument(s):
303b4d4a4aeSGeorge Keishing    # nw_info    A dictionary containing the network information to apply.
304b4d4a4aeSGeorge Keishing
305b4d4a4aeSGeorge Keishing    Run Inband IPMI Standard Command
306b4d4a4aeSGeorge Keishing    ...  lan set 1 ipaddr ${nw_info['IP Address']}
307b4d4a4aeSGeorge Keishing
308b4d4a4aeSGeorge Keishing    Run Inband IPMI Standard Command
309b4d4a4aeSGeorge Keishing    ...  lan set 1 netmask ${nw_info['Subnet Mask']}
310b4d4a4aeSGeorge Keishing
311b4d4a4aeSGeorge Keishing    Run Inband IPMI Standard Command
312b4d4a4aeSGeorge Keishing    ...  lan set 1 defgw ipaddr ${nw_info['Default Gateway IP']}
313