blob: 24ef24c51a9b4c68f19f3fa5ebc2793312debfc6 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing4d6c1da2016-07-15 05:51:22 -05002Documentation This module is for IPMI client for copying ipmitool to
Sivas SRRa2dab3c2016-07-25 05:08:18 -05003... openbmc box and execute ipmitool IPMI standard
4... command. IPMI raw command will use dbus-send command
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06005Resource ../lib/resource.robot
George Keishing4d6c1da2016-07-15 05:51:22 -05006Resource ../lib/connection_client.robot
Prashanth Kattiae7c2282017-03-15 07:43:46 -05007Resource ../lib/utils.robot
8Resource ../lib/state_manager.robot
9
Sivas SRRa2dab3c2016-07-25 05:08:18 -050010Library String
Michael Walsh19621ba2018-12-03 17:16:02 -060011Library ipmi_client.py
Sivas SRRa2dab3c2016-07-25 05:08:18 -050012
13*** Variables ***
George Keishingd7f11f72017-01-04 10:58:19 -060014${dbusHostIpmicmd1}= dbus-send --system ${OPENBMC_BASE_URI}HostIpmi/1
15${dbusHostIpmiCmdReceivedMsg}= ${OPENBMC_BASE_DBUS}.HostIpmi.ReceivedMessage
Gunnar Mills59204d22016-12-06 11:05:19 -060016${netfnByte}= ${EMPTY}
George Keishingd7f11f72017-01-04 10:58:19 -060017${cmdByte}= ${EMPTY}
Gunnar Mills59204d22016-12-06 11:05:19 -060018${arrayByte}= array:byte:
Michael Walsha7913892017-04-20 16:29:01 -050019${IPMI_USER_OPTIONS} ${EMPTY}
George Keishing39967eb2018-04-30 11:36:23 -050020${IPMI_INBAND_CMD}= ipmitool -C ${IPMI_CIPHER_LEVEL}
Gunnar Mills59204d22016-12-06 11:05:19 -060021${HOST}= -H
22${RAW}= raw
Chris Austenb29d2e82016-06-07 12:25:35 -050023
24*** Keywords ***
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050025
Chris Austenb29d2e82016-06-07 12:25:35 -050026Run IPMI Command
Michael Walsh3ef2e922019-01-23 10:40:16 -060027 [Documentation] Run the raw IPMI command.
28 [Arguments] ${command} ${fail_on_err}=${1} &{options}
29
30 # Description of argument(s):
31 # command The IPMI command string to be executed
32 # (e.g. "power status").
33 # fail_on_err Fail if the IPMI command execution fails.
34 # options Additional ipmitool command options (e.g.
35 # -C=3, -I=lanplus, etc.). Currently, only
36 # used for external IPMI commands.
37
Prashanth Kattiae7c2282017-03-15 07:43:46 -050038 ${resp}= Run Keyword If '${IPMI_COMMAND}' == 'External'
Michael Walsh3ef2e922019-01-23 10:40:16 -060039 ... Run External IPMI Raw Command ${command} ${fail_on_err} &{options}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050040 ... ELSE IF '${IPMI_COMMAND}' == 'Inband'
Michael Walsh3ef2e922019-01-23 10:40:16 -060041 ... Run Inband IPMI Raw Command ${command}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050042 ... ELSE IF '${IPMI_COMMAND}' == 'Dbus'
Michael Walsh3ef2e922019-01-23 10:40:16 -060043 ... Run Dbus IPMI RAW Command ${command}
44 ... ELSE Fail msg=Invalid IPMI Command type provided: ${IPMI_COMMAND}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050045 [Return] ${resp}
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050046
Michael Walsh3ef2e922019-01-23 10:40:16 -060047
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050048Run IPMI Standard Command
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050049 [Documentation] Run the standard IPMI command.
Michael Walsh3ef2e922019-01-23 10:40:16 -060050 [Arguments] ${command} ${fail_on_err}=${1} &{options}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -060051
52 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -060053 # command The IPMI command string to be executed
54 # (e.g. "0x06 0x36").
55 # fail_on_err Fail if the IPMI command execution fails.
56 # options Additional ipmitool command options (e.g.
57 # -C=3, -I=lanplus, etc.). Currently, only
58 # used for external IPMI commands.
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -060059
Prashanth Kattiae7c2282017-03-15 07:43:46 -050060 ${resp}= Run Keyword If '${IPMI_COMMAND}' == 'External'
Michael Walsh3ef2e922019-01-23 10:40:16 -060061 ... Run External IPMI Standard Command ${command} ${fail_on_err} &{options}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050062 ... ELSE IF '${IPMI_COMMAND}' == 'Inband'
Michael Walsh3ef2e922019-01-23 10:40:16 -060063 ... Run Inband IPMI Standard Command ${command} ${fail_on_err}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050064 ... ELSE IF '${IPMI_COMMAND}' == 'Dbus'
Michael Walsh3ef2e922019-01-23 10:40:16 -060065 ... Run Dbus IPMI Standard Command ${command}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050066 ... ELSE Fail msg=Invalid IPMI Command type provided : ${IPMI_COMMAND}
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050067
Prashanth Kattiae7c2282017-03-15 07:43:46 -050068 [Return] ${resp}
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050069
Michael Walsh3ef2e922019-01-23 10:40:16 -060070
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050071Run Dbus IPMI RAW Command
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050072 [Documentation] Run the raw IPMI command through dbus.
Michael Walsh3ef2e922019-01-23 10:40:16 -060073 [Arguments] ${command}
74 ${valueinBytes}= Byte Conversion ${command}
Gunnar Mills59204d22016-12-06 11:05:19 -060075 ${cmd}= Catenate ${dbushostipmicmd1} ${dbusHostIpmiCmdReceivedMsg}
76 ${cmd}= Catenate ${cmd} ${valueinBytes}
Sivas SRRa2dab3c2016-07-25 05:08:18 -050077 ${output} ${stderr}= Execute Command ${cmd} return_stderr=True
78 Should Be Empty ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -050079 set test variable ${OUTPUT} "${output}"
80
Michael Walsh3ef2e922019-01-23 10:40:16 -060081
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050082Run Dbus IPMI Standard Command
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050083 [Documentation] Run the standard IPMI command through dbus.
Michael Walsh3ef2e922019-01-23 10:40:16 -060084 [Arguments] ${command}
George Keishing4d6c1da2016-07-15 05:51:22 -050085 Copy ipmitool
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050086 ${stdout} ${stderr} ${output}= Execute Command
Michael Walsh3ef2e922019-01-23 10:40:16 -060087 ... /tmp/ipmitool -I dbus ${command} return_stdout=True
Rahul Maheshwari7a212a02016-09-05 21:17:30 -050088 ... return_stderr= True return_rc=True
Chris Austenb29d2e82016-06-07 12:25:35 -050089 Should Be Equal ${output} ${0} msg=${stderr}
Gunnar Millsc9ea9362016-12-13 16:21:13 -060090 [Return] ${stdout}
Chris Austenb29d2e82016-06-07 12:25:35 -050091
Michael Walsh3ef2e922019-01-23 10:40:16 -060092
Prashanth Kattiae7c2282017-03-15 07:43:46 -050093Run Inband IPMI Raw Command
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050094 [Documentation] Run the raw IPMI command in-band.
Michael Walsh3ef2e922019-01-23 10:40:16 -060095 [Arguments] ${command} ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
Prashanth Kattiae7c2282017-03-15 07:43:46 -050096 ... ${os_password}=${OS_PASSWORD}
97
Michael Walsh3ef2e922019-01-23 10:40:16 -060098 # Description of argument(s):
99 # command The IPMI command string to be executed
100 # (e.g. "0x06 0x36").
101 # os_host The host name or IP address of the OS Host.
102 # os_username The OS host user name.
103 # os_password The OS host passwrd.
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500104
105 Login To OS Host ${os_host} ${os_username} ${os_password}
106 Check If IPMI Tool Exist
107
Michael Walsh3ef2e922019-01-23 10:40:16 -0600108 ${ipmi_cmd}= Catenate ${IPMI_INBAND_CMD} ${RAW} ${command}
109 Qprint Issuing ${ipmi_cmd}
110 ${stdout} ${stderr}= Execute Command ${ipmi_cmd} return_stderr=True
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500111 Should Be Empty ${stderr} msg=${stdout}
112 [Return] ${stdout}
113
Michael Walsh3ef2e922019-01-23 10:40:16 -0600114
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500115Run Inband IPMI Standard Command
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500116 [Documentation] Run the standard IPMI command in-band.
Michael Walsh3ef2e922019-01-23 10:40:16 -0600117 [Arguments] ${command} ${fail_on_err}=${1} ${os_host}=${OS_HOST}
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600118 ... ${os_username}=${OS_USERNAME} ${os_password}=${OS_PASSWORD}
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500119
Michael Walsh3ef2e922019-01-23 10:40:16 -0600120 # Description of argument(s):
121 # command The IPMI command string to be executed
122 # (e.g. "power status").
123 # os_host The host name or IP address of the OS Host.
124 # os_username The OS host user name.
125 # os_password The OS host passwrd.
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500126
127 Login To OS Host ${os_host} ${os_username} ${os_password}
128 Check If IPMI Tool Exist
129
Michael Walsh3ef2e922019-01-23 10:40:16 -0600130 ${ipmi_cmd}= Catenate ${IPMI_INBAND_CMD} ${command}
131 Qprint Issuing ${ipmi_cmd}
132 ${stdout} ${stderr}= Execute Command ${ipmi_cmd} return_stderr=True
Rahul Maheshwari20f3bf72018-12-18 04:24:20 -0600133 Return From Keyword If ${fail_on_err} == ${0} ${stderr}
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500134 Should Be Empty ${stderr} msg=${stdout}
135 [Return] ${stdout}
136
Rahul Maheshwari7a212a02016-09-05 21:17:30 -0500137
138Run External IPMI Standard Command
Michael Walsh3ef2e922019-01-23 10:40:16 -0600139 [Documentation] Run the external IPMI standard command.
140 [Arguments] ${command} ${fail_on_err}=${1} &{options}
George Keishing02651f02018-04-11 02:07:16 -0500141
142 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600143 # command The IPMI command string to be executed
144 # (e.g. "power status"). Note that if
145 # ${IPMI_USER_OPTIONS} has a value (e.g.
146 # "-vvv"), it will be pre-pended to this
147 # command string.
148 # fail_on_err Fail if the IPMI command execution fails.
149 # options Additional ipmitool command options (e.g.
150 # -C=3, -I=lanplus, etc.).
Michael Walsha7913892017-04-20 16:29:01 -0500151
Michael Walsh3ef2e922019-01-23 10:40:16 -0600152 ${command_string}= Process IPMI User Options ${command}
153 ${ipmi_cmd}= Create IPMI Ext Command String ${command_string} &{options}
154 Qprint Issuing ${ipmi_cmd}
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500155 ${rc} ${output}= Run And Return RC and Output ${ipmi_cmd}
George Keishing02651f02018-04-11 02:07:16 -0500156 Return From Keyword If ${fail_on_err} == ${0} ${output}
Michael Walsha7913892017-04-20 16:29:01 -0500157 Should Be Equal ${rc} ${0} msg=${output}
158 [Return] ${output}
Rahul Maheshwari7a212a02016-09-05 21:17:30 -0500159
Michael Walsh3ef2e922019-01-23 10:40:16 -0600160
161Run External IPMI Raw Command
162 [Documentation] Run the external IPMI raw command.
163 [Arguments] ${command} ${fail_on_err}=${1} &{options}
164
165 # This keyword is a wrapper for 'Run External IPMI Standard Command'. See
166 # that keyword's prolog for argument details. This keyword will pre-pend
167 # the word "raw" plus a space to command prior to calling 'Run External
168 # IPMI Standard Command'.
169
170 ${output}= Run External IPMI Standard Command
171 ... raw ${command} ${fail_on_err} &{options}
172 [Return] ${output}
173
174
Prashanth Kattiae7c2282017-03-15 07:43:46 -0500175Check If IPMI Tool Exist
176 [Documentation] Check if IPMI Tool installed or not.
177 ${output}= Execute Command which ipmitool
178 Should Not Be Empty ${output} msg=ipmitool not installed.
Rahul Maheshwari7a212a02016-09-05 21:17:30 -0500179
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500180
181Activate SOL Via IPMI
182 [Documentation] Start SOL using IPMI and route output to a file.
183 [Arguments] ${file_path}=/tmp/sol_${OPENBMC_HOST}
Michael Walsh3ef2e922019-01-23 10:40:16 -0600184
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500185 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600186 # file_path The file path on the local machine (vs.
187 # OBMC) to collect SOL output. By default
188 # SOL output is collected at
189 # /tmp/sol_<BMC_IP> else user input location.
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500190
Michael Walsh3ef2e922019-01-23 10:40:16 -0600191 ${ipmi_cmd}= Create IPMI Ext Command String sol activate usesolkeepalive
192 Qprint Issuing ${ipmi_cmd}
George Keishing2102f6b2017-06-06 08:30:10 -0500193 Start Process ${ipmi_cmd} shell=True stdout=${file_path}
Rahul Maheshwari4f360842017-06-06 15:05:01 -0500194 ... alias=sol_proc
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500195
196
197Deactivate SOL Via IPMI
198 [Documentation] Stop SOL using IPMI and return SOL output.
199 [Arguments] ${file_path}=/tmp/sol_${OPENBMC_HOST}
Michael Walsh3ef2e922019-01-23 10:40:16 -0600200
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500201 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600202 # file_path The file path on the local machine to copy
203 # SOL output collected by above "Activate
204 # SOL Via IPMI" keyword. By default it
205 # copies log from /tmp/sol_<BMC_IP>.
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500206
Michael Walsh3ef2e922019-01-23 10:40:16 -0600207 ${ipmi_cmd}= Create IPMI Ext Command String sol deactivate
208 Qprint Issuing ${ipmi_cmd}
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500209 ${rc} ${output}= Run and Return RC and Output ${ipmi_cmd}
Rahul Maheshwari4f360842017-06-06 15:05:01 -0500210 Run Keyword If ${rc} > 0 Run Keywords
Rahul Maheshwari7f48a2c2017-06-16 04:00:26 -0500211 ... Run Keyword And Ignore Error Terminate Process sol_proc
212 ... AND Return From Keyword ${output}
Rahul Maheshwari04a22042017-05-02 01:54:31 -0500213
214 ${rc} ${output}= Run and Return RC and Output cat ${file_path}
215 Should Be Equal ${rc} ${0} msg=${output}
216
217 # Logging SOL output for debug purpose.
218 Log ${output}
219
220 [Return] ${output}
221
222
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500223Byte Conversion
224 [Documentation] Byte Conversion method receives IPMI RAW commands as
225 ... argument in string format.
226 ... Sample argument is as follows
227 ... "0x04 0x30 9 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00
228 ... 0x00"
229 ... IPMI RAW command format is as follows
230 ... <netfn Byte> <cmd Byte> <Data Bytes..>
231 ... This method converts IPMI command format into
232 ... dbus command format as follows
233 ... <byte:seq-id> <byte:netfn> <byte:lun> <byte:cmd>
234 ... <array:byte:data>
235 ... Sample dbus Host IPMI Received Message argument
236 ... byte:0x00 byte:0x04 byte:0x00 byte:0x30
237 ... array:byte:9,0x01,0x00,0x35,0x00,0x00,0x00,0x00,0x00,0x00
Gunnar Mills38032802016-12-12 13:43:40 -0600238 [Arguments] ${args}
Gunnar Mills59204d22016-12-06 11:05:19 -0600239 ${argLength}= Get Length ${args}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500240 Set Global Variable ${arrayByte} array:byte:
Gunnar Mills59204d22016-12-06 11:05:19 -0600241 @{listargs}= Split String ${args}
242 ${index}= Set Variable ${0}
George Keishing9a089442018-12-10 09:38:50 -0600243 :FOR ${word} IN @{listargs}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500244 \ Run Keyword if ${index} == 0 Set NetFn Byte ${word}
245 \ Run Keyword if ${index} == 1 Set Cmd Byte ${word}
246 \ Run Keyword if ${index} > 1 Set Array Byte ${word}
Gunnar Mills59204d22016-12-06 11:05:19 -0600247 \ ${index}= Set Variable ${index + 1}
248 ${length}= Get Length ${arrayByte}
249 ${length}= Evaluate ${length} - 1
250 ${arrayByteLocal}= Get Substring ${arrayByte} 0 ${length}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500251 Set Global Variable ${arrayByte} ${arrayByteLocal}
Gunnar Mills59204d22016-12-06 11:05:19 -0600252 ${valueinBytesWithArray}= Catenate byte:0x00 ${netfnByte} byte:0x00
253 ${valueinBytesWithArray}= Catenate ${valueinBytesWithArray} ${cmdByte}
254 ${valueinBytesWithArray}= Catenate ${valueinBytesWithArray} ${arrayByte}
255 ${valueinBytesWithoutArray}= Catenate byte:0x00 ${netfnByte} byte:0x00
256 ${valueinBytesWithoutArray}= Catenate ${valueinBytesWithoutArray} ${cmdByte}
Michael Walsh3ef2e922019-01-23 10:40:16 -0600257 # To Check scenario for smaller IPMI raw commands with only 2 arguments
258 # instead of usual 12 arguments.
259 # Sample small IPMI raw command: Run IPMI command 0x06 0x36
260 # If IPMI raw argument length is only 9 then return value in bytes without
261 # array population.
262 # Equivalent dbus-send argument for smaller IPMI raw command:
263 # byte:0x00 byte:0x06 byte:0x00 byte:0x36
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500264 Run Keyword if ${argLength} == 9 Return from Keyword ${valueinBytesWithoutArray}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600265 [Return] ${valueinBytesWithArray}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500266
267
268Set NetFn Byte
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500269 [Documentation] Set the network function byte.
270 [Arguments] ${word}
271 ${netfnByteLocal}= Catenate byte:${word}
272 Set Global Variable ${netfnByte} ${netfnByteLocal}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500273
Michael Walsh3ef2e922019-01-23 10:40:16 -0600274
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500275Set Cmd Byte
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500276 [Documentation] Set the command byte.
277 [Arguments] ${word}
278 ${cmdByteLocal}= Catenate byte:${word}
279 Set Global Variable ${cmdByte} ${cmdByteLocal}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500280
Michael Walsh3ef2e922019-01-23 10:40:16 -0600281
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500282Set Array Byte
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500283 [Documentation] Set the array byte.
284 [Arguments] ${word}
285 ${arrayByteLocal}= Catenate SEPARATOR= ${arrayByte} ${word}
286 ${arrayByteLocal}= Catenate SEPARATOR= ${arrayByteLocal} ,
287 Set Global Variable ${arrayByte} ${arrayByteLocal}
Sivas SRRa2dab3c2016-07-25 05:08:18 -0500288
Michael Walsh3ef2e922019-01-23 10:40:16 -0600289
Chris Austenb29d2e82016-06-07 12:25:35 -0500290Copy ipmitool
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500291 [Documentation] Copy the ipmitool to the BMC.
292 ${ipmitool_error}= Catenate The ipmitool program could not be found in the tools directory.
293 ... It is not part of the automation code by default. You must manually copy or link the correct openbmc
294 ... version of the tool in to the tools directory in order to run this test suite.
295
296 OperatingSystem.File Should Exist tools/ipmitool msg=${ipmitool_error}
Chris Austenb29d2e82016-06-07 12:25:35 -0500297
298 Import Library SCPLibrary WITH NAME scp
299 scp.Open connection ${OPENBMC_HOST} username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD}
300 scp.Put File tools/ipmitool /tmp
301 SSHLibrary.Open Connection ${OPENBMC_HOST}
302 Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
303 Execute Command chmod +x /tmp/ipmitool
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500304
Michael Walsh3ef2e922019-01-23 10:40:16 -0600305
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500306Initiate Host Boot Via External IPMI
307 [Documentation] Initiate host power on using external IPMI.
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500308 [Arguments] ${wait}=${1}
Michael Walsh3ef2e922019-01-23 10:40:16 -0600309
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500310 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600311 # wait Indicates that this keyword should wait
312 # for host running state.
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500313
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500314 ${output}= Run External IPMI Standard Command chassis power on
315 Should Not Contain ${output} Error
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500316
317 Run Keyword If '${wait}' == '${0}' Return From Keyword
318 Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500319
Michael Walsh3ef2e922019-01-23 10:40:16 -0600320
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500321Initiate Host PowerOff Via External IPMI
322 [Documentation] Initiate host power off using external IPMI.
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500323 [Arguments] ${wait}=${1}
Michael Walsh3ef2e922019-01-23 10:40:16 -0600324
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500325 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600326 # wait Indicates that this keyword should wait
327 # for host off state.
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500328
Sridevi Ramesh0c34f692017-04-25 02:40:32 -0500329 ${output}= Run External IPMI Standard Command chassis power off
330 Should Not Contain ${output} Error
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500331
332 Run Keyword If '${wait}' == '${0}' Return From Keyword
333 Wait Until Keyword Succeeds 3 min 10 sec Is Host Off
334
Michael Walsh3ef2e922019-01-23 10:40:16 -0600335
Rahul Maheshwari982fee42017-05-03 00:33:15 -0500336Get Host State Via External IPMI
337 [Documentation] Returns host state using external IPMI.
338
339 ${output}= Run External IPMI Standard Command chassis power status
340 Should Not Contain ${output} Error
341 ${output}= Fetch From Right ${output} ${SPACE}
342
343 [Return] ${output}
George Keishingb4d4a4a2018-08-27 13:35:39 -0500344
345
346Set BMC Network From Host
347 [Documentation] Set BMC network from host.
348 [Arguments] ${nw_info}
349
350 # Description of argument(s):
Michael Walsh3ef2e922019-01-23 10:40:16 -0600351 # nw_info A dictionary containing the network
352 # information to apply.
George Keishingb4d4a4a2018-08-27 13:35:39 -0500353
354 Run Inband IPMI Standard Command
355 ... lan set 1 ipaddr ${nw_info['IP Address']}
356
357 Run Inband IPMI Standard Command
358 ... lan set 1 netmask ${nw_info['Subnet Mask']}
359
360 Run Inband IPMI Standard Command
361 ... lan set 1 defgw ipaddr ${nw_info['Default Gateway IP']}
Rahul Maheshwaric3d1e962019-03-06 23:53:21 -0600362
363
364Verify IPMI Username And Password
365 [Documentation] Verify that user is able to run IPMI command
366 ... with given username and password.
367 [Arguments] ${username} ${password}
368
369 # Description of argument(s):
370 # username The user name (e.g. "root", "robert", etc.).
371 # password The user password (e.g. "0penBmc", "0penBmc1", etc.).
372
373 ${output}= Run External IPMI Standard Command
374 ... sel info U=${username} P=${password}
375 Should Contain ${output} SEL Information msg=SEL information not present