blob: cb3152256c080bf2cd9300bb3c7c4846069372d9 [file] [log] [blame]
Steven Sombarf60cbcf2018-12-07 08:12:18 -06001*** Settings ***
2
3Documentation Utilities for Robot keywords that do not use REST.
4
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06005Resource ../lib/resource.robot
Steven Sombarf60cbcf2018-12-07 08:12:18 -06006Resource ../lib/connection_client.robot
7Resource ../lib/boot_utils.robot
8Library String
9Library DateTime
10Library Process
11Library OperatingSystem
12Library gen_print.py
13Library gen_robot_print.py
14Library gen_cmd.py
Michael Walsh07ed7942019-11-08 14:41:30 -060015Library gen_robot_valid.py
Steven Sombarf60cbcf2018-12-07 08:12:18 -060016Library gen_robot_keyword.py
17Library bmc_ssh_utils.py
18Library utils.py
19Library var_funcs.py
George Keishingb5c119e2025-03-25 20:45:03 +053020Library SCPLibrary AS scp
Steven Sombarf60cbcf2018-12-07 08:12:18 -060021
22*** Variables ***
23
24${pflash_cmd} /usr/sbin/pflash -r /dev/stdout -P VERSION
25
Steven Sombarf60cbcf2018-12-07 08:12:18 -060026# Assign default value to QUIET for programs which may not define it.
27${QUIET} ${0}
28
29${bmc_mem_free_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f4
30${bmc_mem_total_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f2
31${bmc_cpu_usage_cmd}= top -n 1 | grep CPU: | cut -c 7-9
32${HOST_SETTING} ${SETTINGS_URI}host0
33
34# /run/initramfs/ro associate filesystem should be 100% full always
35${bmc_file_system_usage_cmd}= df -h | cut -c 52-54 | grep 100 | wc -l
36${total_pnor_ro_file_system_cmd}= df -h | grep /media/pnor-ro | wc -l
37${total_bmc_ro_file_system_cmd}= df -h | grep /media/rofs | wc -l
38
39${BOOT_TIME} ${0}
40${BOOT_COUNT} ${0}
41${count} ${0}
42${devicetree_base} /sys/firmware/devicetree/base/model
43
44# Initialize default debug value to 0.
45${DEBUG} ${0}
46
47${probe_cpu_tool_path} ${EXECDIR}/tools/ras/probe_cpus.sh
48${scom_addrs_tool_path} ${EXECDIR}/tools/ras/scom_addr_p9.sh
49${target_file_path} /root/
50
51${default_tarball} ${EXECDIR}/obmc-phosphor-debug-tarball-witherspoon.tar.xz
52
53# These variables are used to straddle between new and old methods of setting
54# values.
55${bmc_power_policy_method} ${EMPTY}
56@{valid_power_policy_vars} RESTORE_LAST_STATE ALWAYS_POWER_ON
57... ALWAYS_POWER_OFF
58
George Keishingb9f3f772020-01-15 23:23:08 -060059${check_performance} ${1}
60
Steven Sombarf60cbcf2018-12-07 08:12:18 -060061
62*** Keywords ***
63
64Check BMC Performance
65 [Documentation] Check BMC basic CPU Mem File system performance.
66
George Keishingb9f3f772020-01-15 23:23:08 -060067 Return From Keyword If not ${check_performance}
68
Steven Sombarf60cbcf2018-12-07 08:12:18 -060069 Check BMC CPU Performance
70 Check BMC Mem Performance
71 Check BMC File System Performance
72
73
74Verify PNOR Update
75 [Documentation] Verify that the PNOR is not corrupted.
76 # Example:
77 # FFS: Flash header not found. Code: 100
78 # Error 100 opening ffs !
79
80 ${stdout} ${stderr} ${rc}=
81 ... BMC Execute Command /usr/sbin/pflash -h | egrep -q skip
82 ... ignore_err=${1}
83 ${pflash_cmd}= Set Variable If ${rc} == ${0} ${pflash_cmd} --skip=4096
84 ... ${pflash_cmd}
85 ${pnor_info}= BMC Execute Command ${pflash_cmd}
86 Should Not Contain Any ${pnor_info} Flash header not found Error
87
88
89Get BMC System Model
90 [Documentation] Get the BMC model from the device tree and return it.
91
92 ${bmc_model} ${stderr} ${rc}= BMC Execute Command
93 ... cat ${devicetree_base} | cut -d " " -f 1 return_stderr=True
94 ... test_mode=0
95 Should Be Empty ${stderr}
96 Should Not Be Empty ${bmc_model} msg=BMC model is empty.
George Keishing409df052024-01-17 22:36:14 +053097 RETURN ${bmc_model}
Steven Sombarf60cbcf2018-12-07 08:12:18 -060098
99
100Verify BMC System Model
101 [Documentation] Verify the BMC model with ${OPENBMC_MODEL}.
102 [Arguments] ${bmc_model}
103
104 # Description of argument(s):
105 # bmc_model System model (e.g. "witherspoon").
106
107 ${tmp_bmc_model}= Fetch From Right ${OPENBMC_MODEL} /
108 ${tmp_bmc_model}= Fetch From Left ${tmp_bmc_model} .
109 ${ret}= Run Keyword And Return Status Should Contain ${bmc_model}
110 ... ${tmp_bmc_model} ignore_case=True
George Keishing409df052024-01-17 22:36:14 +0530111 RETURN ${ret}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600112
113
114Wait For Host To Ping
115 [Documentation] Wait for the given host to ping.
116 [Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}min
Sushil Singh7d5a4302023-08-20 23:55:48 -0500117 ... ${interval}=5 sec ${expected_rc}=${0}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600118
119 # Description of argument(s):
Sushil Singh7d5a4302023-08-20 23:55:48 -0500120 # host The host name or IP of the host to ping.
121 # timeout The amount of time after which ping attempts cease.
122 # This should be expressed in Robot Framework's time format
123 # (e.g. "10 seconds").
124 # interval The amount of time in between attempts to ping.
125 # This should be expressed in Robot Framework's time format
126 # (e.g. "5 seconds").
127 # expected_rc Expected return code of ping command.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600128
Sushil Singh7d5a4302023-08-20 23:55:48 -0500129 Wait Until Keyword Succeeds ${timeout} ${interval} Ping Host ${host} ${expected_rc}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600130
131
132Ping Host
133 [Documentation] Ping the given host.
Sushil Singh7d5a4302023-08-20 23:55:48 -0500134 [Arguments] ${host} ${expected_rc}=${0}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600135
136 # Description of argument(s):
Sushil Singh7d5a4302023-08-20 23:55:48 -0500137 # host The host name or IP of the host to ping.
138 # expected_rc Expected return code of ping command.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600139
140 Should Not Be Empty ${host} msg=No host provided
Sushil Singh7d5a4302023-08-20 23:55:48 -0500141 ${rc} ${output}= Run and return RC and Output ping -c 4 ${host}
142 Log RC: ${rc}\nOutput:\n${output}
143 Should be equal ${rc} ${expected_rc}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600144
145
146Check OS
147 [Documentation] Attempts to ping the host OS and then checks that the host
148 ... OS is up by running an SSH command.
149
150 [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
151 ... ${os_password}=${OS_PASSWORD} ${quiet}=${QUIET}
152 ... ${print_string}=${EMPTY}
153 [Teardown] SSHLibrary.Close Connection
154
155 # Description of argument(s):
156 # os_host The DNS name/IP of the OS host associated with our BMC.
157 # os_username The username to be used to sign on to the OS host.
158 # os_password The password to be used to sign on to the OS host.
159 # quiet Indicates whether this keyword should write to console.
160 # print_string A string to be printed before checking the OS.
161
Michael Walshc108e422019-03-28 12:27:18 -0500162 Log To Console ${print_string} no_newline=True
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600163
164 # Attempt to ping the OS. Store the return code to check later.
165 ${ping_rc}= Run Keyword and Return Status Ping Host ${os_host}
166
167 SSHLibrary.Open connection ${os_host}
168
George Keishing30751662019-03-05 06:35:55 -0600169 ${status} ${msg}= Run Keyword And Ignore Error SSHLibrary.Login ${os_username}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600170 ... ${os_password}
171 ${err_msg1}= Sprint Error ${msg}
172 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
173 Run Keyword If '${status}' == 'FAIL' Fail msg=${err_msg}
174 ${output} ${stderr} ${rc}= Execute Command uptime return_stderr=True
175 ... return_rc=True
176
177 ${temp_msg}= Catenate Could not execute a command on the operating
178 ... system.\n
179 ${err_msg1}= Sprint Error ${temp_msg}
180 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
181
182 # If the return code returned by "Execute Command" is non-zero, this
183 # keyword will fail.
184 Should Be Equal ${rc} ${0} msg=${err_msg}
185 # We will likewise fail if there is any stderr data.
186 Should Be Empty ${stderr}
187
188 ${temp_msg}= Set Variable Could not ping the operating system.\n
189 ${err_msg1}= Sprint Error ${temp_msg}
190 ${err_msg}= Catenate SEPARATOR= \n ${err_msg1}
191 # We will likewise fail if the OS did not ping, as we could SSH but not
192 # ping
193 Should Be Equal As Strings ${ping_rc} ${TRUE} msg=${err_msg}
194
195
196Wait for OS
197 [Documentation] Waits for the host OS to come up via calls to "Check OS".
198 [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
199 ... ${os_password}=${OS_PASSWORD} ${timeout}=${OS_WAIT_TIMEOUT}
200 ... ${quiet}=${0}
Michael Walshc108e422019-03-28 12:27:18 -0500201 [Teardown] Printn
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600202
203 # Description of argument(s):
204 # os_host The DNS name or IP of the OS host associated with our
205 # BMC.
206 # os_username The username to be used to sign on to the OS host.
207 # os_password The password to be used to sign on to the OS host.
208 # timeout The timeout in seconds indicating how long you're
209 # willing to wait for the OS to respond.
210 # quiet Indicates whether this keyword should write to console.
211
212 # The interval to be used between calls to "Check OS".
213 ${interval}= Set Variable 5
214
215 ${message}= Catenate Checking every ${interval} seconds for up to
216 ... ${timeout} seconds for the operating system to communicate.
Michael Walshc108e422019-03-28 12:27:18 -0500217 Qprint Timen ${message}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600218
219 Wait Until Keyword Succeeds ${timeout} sec ${interval} Check OS
220 ... ${os_host} ${os_username} ${os_password}
221 ... print_string=\#
222
Michael Walshc108e422019-03-28 12:27:18 -0500223 Qprintn
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600224
Michael Walshc108e422019-03-28 12:27:18 -0500225 Qprint Timen The operating system is now communicating.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600226
227
228Copy PNOR to BMC
229 [Documentation] Copy the PNOR image to the BMC.
George Keishingb5c119e2025-03-25 20:45:03 +0530230 Import Library SCPLibrary AS scp
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600231 Open Connection for SCP
232 Log Copying ${PNOR_IMAGE_PATH} to /tmp
233 scp.Put File ${PNOR_IMAGE_PATH} /tmp
234
235
236Is OS Starting
237 [Documentation] Check if boot progress is OS starting.
238 ${boot_progress}= Get Boot Progress
239 Should Be Equal ${boot_progress} OSStart
240
241
242Is OS Off
243 [Documentation] Check if boot progress is "Off".
244 ${boot_progress}= Get Boot Progress
245 Should Be Equal ${boot_progress} Off
246
247
248Get Boot Progress To OS Starting State
249 [Documentation] Get the system to a boot progress state of 'FW Progress,
250 ... Starting OS'.
251
252 ${boot_progress}= Get Boot Progress
253 Run Keyword If '${boot_progress}' == 'OSStart'
254 ... Log Host is already in OS starting state
255 ... ELSE
256 ... Run Keywords Initiate Host PowerOff AND Initiate Host Boot
257 ... AND Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
258
259
260Check If warmReset is Initiated
261 [Documentation] Ping would be still alive, so try SSH to connect
262 ... if fails the ports are down indicating reboot
263 ... is in progress
264
265 # Warm reset adds 3 seconds delay before forcing reboot
266 # To minimize race conditions, we wait for 7 seconds
267 Sleep 7s
268 ${alive}= Run Keyword and Return Status
269 ... Open Connection And Log In
270 Return From Keyword If '${alive}' == '${False}' ${False}
George Keishing409df052024-01-17 22:36:14 +0530271 RETURN ${True}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600272
273
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600274Create OS Console Command String
275 [Documentation] Return a command string to start OS console logging.
276
277 # First make sure that the ssh_pw program is available.
278 ${cmd}= Catenate which ssh_pw 2>/dev/null || find
279 ... ${EXECDIR} -name 'ssh_pw'
280
Michael Walshc108e422019-03-28 12:27:18 -0500281 Dprint Issuing ${cmd}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600282 ${rc} ${output}= Run And Return Rc And Output ${cmd}
283 Rdpvars rc output
284
285 Should Be Equal As Integers 0 ${rc} msg=Could not find ssh_pw.
286
287 ${ssh_pw_file_path}= Set Variable ${output}
288
George Keishing088166c2019-12-13 08:11:28 -0600289 ${cmd}= Catenate ${ssh_pw_file_path} ${OPENBMC_PASSWORD} -p ${HOST_SOL_PORT}
Jorge Cisnerosf196b242022-09-09 15:46:15 +0000290 ... -o "StrictHostKeyChecking no" ${OPENBMC_USERNAME}@${OPENBMC_HOST} ${OPENBMC_CONSOLE_CLIENT}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600291
George Keishing409df052024-01-17 22:36:14 +0530292 RETURN ${cmd.strip()}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600293
294
295Get SOL Console Pid
296 [Documentation] Get the pid of the active SOL console job.
Michael Walsh07ed7942019-11-08 14:41:30 -0600297 [Arguments] ${expect_running}=${0} ${log_file_path}=${EMPTY}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600298
299 # Description of argument(s):
Michael Walsh07ed7942019-11-08 14:41:30 -0600300 # expect_running If set and if no SOL console job is found, print debug info and fail.
301 # log_file_path Needed to print debug info if expect_running is set and no pid is found.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600302
303 # Find the pid of the active system console logging session (if any).
304 ${search_string}= Create OS Console Command String
305 # At least in some cases, ps output does not show double quotes so we must
306 # replace them in our search string with the regexes to indicate that they
307 # are optional.
308 ${search_string}= Replace String ${search_string} " ["]?
309 ${ps_cmd}= Catenate ps axwwo user,pid,cmd
310 ${cmd_buf}= Catenate echo $(${ps_cmd} | egrep '${search_string}' |
311 ... egrep -v grep | cut -c10-14)
Michael Walshc108e422019-03-28 12:27:18 -0500312 Dprint Issuing ${cmd_buf}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600313 ${rc} ${os_con_pid}= Run And Return Rc And Output ${cmd_buf}
314 Rdpvars os_con_pid
315 # If rc is not zero it just means that there is no OS Console process
316 # running.
317
318 Return From Keyword If '${os_con_pid}' != '${EMPTY}' ${os_con_pid}
319 Return From Keyword If '${expect_running}' == '${0}' ${os_con_pid}
320
321 Cmd Fnc cat ${log_file_path} ; echo ; ${ps_cmd} quiet=${0}
322 ... print_output=${1} show_err=${1}
Michael Walsh07ed7942019-11-08 14:41:30 -0600323 Valid Value os_con_pid
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600324
325
326Stop SOL Console Logging
327 [Documentation] Stop system console logging and return log output.
328 [Arguments] ${log_file_path}=${EMPTY}
329 ... ${targ_file_path}=${EXECDIR}${/}logs${/}
330 ... ${return_data}=${1}
331
George Keishinge16f1582022-12-15 07:32:21 -0600332 # If there are multiple system console processes, they will all be stopped.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600333 # If there is no existing log file this keyword will return an error
334 # message to that effect (and write that message to targ_file_path, if
335 # specified).
336 # NOTE: This keyword will not fail if there is no running system console
337 # process.
338
339 # Description of arguments:
340 # log_file_path The file path that was used to call "Start SOL
341 # Console Logging". See that keyword (above) for details.
342 # targ_file_path If specified, the file path to which the source
343 # file path (i.e. "log_file_path") should be copied.
344 # return_data If this is set to ${1}, this keyword will return the SOL
345 # data to the caller as a unicode string.
346
347 ${log_file_path}= Create OS Console File Path ${log_file_path}
348
349 ${os_con_pid}= Get SOL Console Pid
350
351 ${cmd_buf}= Catenate kill -9 ${os_con_pid}
Michael Walshc108e422019-03-28 12:27:18 -0500352 Run Keyword If '${os_con_pid}' != '${EMPTY}' Dprint Issuing ${cmd_buf}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600353 ${rc} ${output}= Run Keyword If '${os_con_pid}' != '${EMPTY}'
354 ... Run And Return Rc And Output ${cmd_buf}
355 Run Keyword If '${os_con_pid}' != '${EMPTY}' Rdpvars rc output
356
357 Run Keyword If '${targ_file_path}' != '${EMPTY}'
358 ... Run Keyword And Ignore Error
359 ... Copy File ${log_file_path} ${targ_file_path}
360
361 ${output}= Set Variable ${EMPTY}
362 ${loc_quiet}= Evaluate ${debug}^1
363 ${rc} ${output}= Run Keyword If '${return_data}' == '${1}'
364 ... Cmd Fnc cat ${log_file_path} 2>/dev/null quiet=${loc_quiet}
365 ... print_output=${0} show_err=${0}
366
George Keishing409df052024-01-17 22:36:14 +0530367 RETURN ${output}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600368
369
370Start SOL Console Logging
371 [Documentation] Start system console log to file.
372 [Arguments] ${log_file_path}=${EMPTY} ${return_data}=${1}
373
374 # This keyword will first call "Stop SOL Console Logging". Only then will
375 # it start SOL console logging. The data returned by "Stop SOL Console
376 # Logging" will in turn be returned by this keyword.
377
378 # Description of arguments:
379 # log_file_path The file path to which system console log data should be
380 # written. Note that this path is taken to be a location
381 # on the machine where this program is running rather than
382 # on the Open BMC system.
383 # return_data If this is set to ${1}, this keyword will return any SOL
384 # data to the caller as a unicode string.
385
386 ${log_file_path}= Create OS Console File Path ${log_file_path}
387
388 ${log_output}= Stop SOL Console Logging ${log_file_path}
389 ... return_data=${return_data}
390
391 # Validate by making sure we can create the file. Problems creating the
392 # file would not be noticed by the subsequent ssh command because we fork
393 # the command.
394 Create File ${log_file_path}
395 ${sub_cmd_buf}= Create OS Console Command String
396 # Routing stderr to stdout so that any startup error text will go to the
397 # output file.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600398 ${cmd_buf}= Catenate ${sub_cmd_buf} > ${log_file_path} 2>&1 &
Michael Walshc108e422019-03-28 12:27:18 -0500399 Dprint Issuing ${cmd_buf}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600400 ${rc} ${output}= Run And Return Rc And Output ${cmd_buf}
401 # Because we are forking this command, we essentially will never get a
402 # non-zero return code or any output.
403 Should Be Equal ${rc} ${0}
404
405 Wait Until Keyword Succeeds 10 seconds 0 seconds
Michael Walsh07ed7942019-11-08 14:41:30 -0600406 ... Get SOL Console Pid ${1} ${log_file_path}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600407
George Keishing409df052024-01-17 22:36:14 +0530408 RETURN ${log_output}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600409
410
411Get Time Stamp
412 [Documentation] Get the current time stamp data
413 ${cur_time}= Get Current Date result_format=%Y%m%d%H%M%S%f
George Keishing409df052024-01-17 22:36:14 +0530414 RETURN ${cur_time}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600415
416
417Start Journal Log
418 [Documentation] Start capturing journal log to a file in /tmp using
419 ... journalctl command. By default journal log is collected
420 ... at /tmp/journal_log else user input location.
421 ... The File is appended with datetime.
422 [Arguments] ${file_path}=/tmp/journal_log ${filter}=${EMPTY}
423
424 # Description of arguments:
425 # file_path The file path of the journal file.
426
427 ${cur_time}= Get Time Stamp
428 Set Global Variable ${LOG_TIME} ${cur_time}
429 Open Connection And Log In
430 Start Command
431 ... journalctl -f ${filter} > ${file_path}-${LOG_TIME}
432 Log Journal Log Started: ${file_path}-${LOG_TIME}
433
434
435Stop Journal Log
436 [Documentation] Stop journalctl process if its running.
437 ... By default return log from /tmp/journal_log else
438 ... user input location.
439 [Arguments] ${file_path}=/tmp/journal_log
440
441 # Description of arguments:
442 # file_path The file path of the journal file.
443
444 Open Connection And Log In
445
446 ${rc}=
447 ... Execute Command
448 ... ps | grep journalctl | grep -v grep
449 ... return_stdout=False return_rc=True
450
451 Return From Keyword If '${rc}' == '${1}'
452 ... No journal log process running
453
454 ${output} ${stderr}=
455 ... Execute Command killall journalctl
456 ... return_stderr=True
457 Should Be Empty ${stderr}
458
459 ${journal_log} ${stderr}=
460 ... Execute Command
461 ... cat ${file_path}-${LOG_TIME}
462 ... return_stderr=True
463 Should Be Empty ${stderr}
464
465 Log ${journal_log}
466
467 Execute Command rm ${file_path}-${LOG_TIME}
468
George Keishing409df052024-01-17 22:36:14 +0530469 RETURN ${journal_log}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600470
471
472Mac Address To Hex String
473 [Documentation] Converts MAC address into hex format.
474 ... Example
475 ... Given the following MAC: 00:01:6C:80:02:78
476 ... This keyword will return: 0x00 0x01 0x6C 0x80 0x02 0x78
477 ... Description of arguments:
478 ... i_macaddress MAC address in the following format
479 ... 00:01:6C:80:02:78
480 [Arguments] ${i_macaddress}
481
482 # Description of arguments:
483 # i_macaddress The MAC address.
484
485 ${mac_hex}= Catenate 0x${i_macaddress.replace(':', ' 0x')}
George Keishing409df052024-01-17 22:36:14 +0530486 RETURN ${mac_hex}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600487
488
489IP Address To Hex String
490 [Documentation] Converts IP address into hex format.
491 ... Example:
492 ... Given the following IP: 10.3.164.100
493 ... This keyword will return: 0xa 0x3 0xa4 0xa0
494 [Arguments] ${i_ipaddress}
495
496 # Description of arguments:
497 # i_macaddress The IP address in the format 10.10.10.10.
498
499 @{ip}= Split String ${i_ipaddress} .
500 ${index}= Set Variable ${0}
501
Marissa Garza20ccfc72020-06-19 12:51:10 -0500502 FOR ${item} IN @{ip}
503 ${hex}= Convert To Hex ${item} prefix=0x lowercase=yes
504 Set List Value ${ip} ${index} ${hex}
505 ${index}= Set Variable ${index + 1}
506 END
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600507 ${ip_hex}= Catenate @{ip}
508
George Keishing409df052024-01-17 22:36:14 +0530509 RETURN ${ip_hex}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600510
511
512BMC CPU Performance Check
513 [Documentation] Minimal 10% of proc should be free in this instance
514
515 ${bmc_cpu_usage_output} ${stderr} ${rc}= BMC Execute Command
516 ... ${bmc_cpu_usage_cmd}
517 ${bmc_cpu_usage_output} ${stderr} ${rc}= BMC Execute Command
518 ... ${bmc_cpu_usage_cmd}
519 ${bmc_cpu_percentage}= Fetch From Left ${bmc_cpu_usage_output} %
Sivas SRR14426bc2019-04-10 10:14:46 -0500520 Rprint Vars bmc_cpu_percentage
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600521 Should be true ${bmc_cpu_percentage} < 90
522
523
524BMC Mem Performance Check
525 [Documentation] Minimal 10% of memory should be free in this instance
526
527 ${bmc_mem_free_output} ${stderr} ${rc}= BMC Execute Command
528 ... ${bmc_mem_free_cmd}
529
530 ${bmc_mem_total_output} ${stderr} ${rc}= BMC Execute Command
531 ... ${bmc_mem_total_cmd}
532 ${bmc_mem_free_output} ${stderr} ${rc}= BMC Execute Command
533 ... ${bmc_mem_free_cmd}
534
535 ${bmc_mem_total_output} ${stderr} ${rc}= BMC Execute Command
536 ... ${bmc_mem_total_cmd}
537
538 ${bmc_mem_percentage}= Evaluate ${bmc_mem_free_output}*100
539 ${bmc_mem_percentage}= Evaluate
540 ... ${bmc_mem_percentage}/${bmc_mem_total_output}
Sivas SRR14426bc2019-04-10 10:14:46 -0500541 Rprint Vars bmc_mem_percentage
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600542 Should be true ${bmc_mem_percentage} > 10
543
544
545BMC File System Usage Check
546 [Documentation] Check the file system space. 4 file system should be
547 ... 100% full which is expected
548 # Filesystem Size Used Available Use% Mounted on
549 # /dev/root 14.4M 14.4M 0 100% /
550 # /dev/ubiblock0_0 14.4M 14.4M 0 100% /media/rofs-c9249b0e
551 # /dev/ubiblock8_0 19.6M 19.6M 0 100% /media/pnor-ro-8764baa3
552 # /dev/ubiblock4_0 14.4M 14.4M 0 100% /media/rofs-407816c
553 # /dev/ubiblock8_4 21.1M 21.1M 0 100% /media/pnor-ro-cecc64c4
554 ${bmc_fs_usage_output} ${stderr} ${rc}= BMC Execute Command
555 ... ${bmc_file_system_usage_cmd}
556 ${bmc_pnor_fs_usage_output} ${stderr} ${rc}= BMC Execute Command
557 ... ${total_pnor_ro_file_system_cmd}
558 ${bmc_bmc_fs_usage_output} ${stderr} ${rc}= BMC Execute Command
559 ... ${total_bmc_ro_file_system_cmd}
560 ${total_bmc_pnor_image}= Evaluate
561 ... ${bmc_pnor_fs_usage_output}+${bmc_bmc_fs_usage_output}
562 # Considering /dev/root also in total 100% used file system
563 ${total_full_fs}= Evaluate ${total_bmc_pnor_image}+1
Sivas SRR14426bc2019-04-10 10:14:46 -0500564 Rprint Vars bmc_fs_usage_output bmc_pnor_fs_usage_output bmc_bmc_fs_usage_output
565 ... total_full_fs
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600566 Should Be True ${bmc_fs_usage_output}==${total_full_fs}
567
568
569Check BMC CPU Performance
570 [Documentation] Minimal 10% of proc should be free in 3 sample
Marissa Garza20ccfc72020-06-19 12:51:10 -0500571 FOR ${var} IN RANGE 1 4
572 BMC CPU Performance Check
573 END
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600574
575Check BMC Mem Performance
576 [Documentation] Minimal 10% of memory should be free
577
Marissa Garza20ccfc72020-06-19 12:51:10 -0500578 FOR ${var} IN RANGE 1 4
579 BMC Mem Performance Check
580 END
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600581
582Check BMC File System Performance
583 [Documentation] Check for file system usage for 4 times
584
Marissa Garza20ccfc72020-06-19 12:51:10 -0500585 FOR ${var} IN RANGE 1 4
586 BMC File System Usage check
587 END
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600588
589Get URL List
590 [Documentation] Return list of URLs under given URL.
591 [Arguments] ${openbmc_url}
592
593 # Description of argument(s):
594 # openbmc_url URL for list operation (e.g.
595 # /xyz/openbmc_project/inventory).
596
Steven Sombaraaaab222018-12-19 13:16:23 -0600597 ${url_list}= Read Properties ${openbmc_url}list quiet=${1}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600598 Sort List ${url_list}
599
George Keishing409df052024-01-17 22:36:14 +0530600 RETURN ${url_list}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600601
602
603Check Zombie Process
604 [Documentation] Check if any defunct process exist or not on BMC
605 ${count} ${stderr} ${rc}= Execute Command ps -o stat | grep Z | wc -l
606 ... return_stderr=True return_rc=True
607 Should Be True ${count}==0
608 Should Be Empty ${stderr}
609
610
611Prune Journal Log
612 [Documentation] Prune archived journal logs.
613 [Arguments] ${vacuum_size}=1M
614
615 # This keyword can be used to prevent the journal
616 # log from filling up the /run filesystem.
617 # This command will retain only the latest logs
618 # of the user specified size.
619
620 # Description of argument(s):
621 # vacuum_size Size of journal.
622
623 Open Connection And Log In
624 ${output} ${stderr} ${rc}=
625 ... Execute Command
626 ... journalctl --vacuum-size=${vacuum_size}
627 ... return_stderr=True return_rc=True
628
629 Should Be Equal ${rc} ${0} msg=${stderr}
630
631
632Get System Power Policy
633 [Documentation] Returns the BMC power policy.
634
635 # Set the bmc_power_policy_method to either 'Old' or 'New'.
636 Set Power Policy Method
637 ${cmd_buf}= Create List ${bmc_power_policy_method} Get Power Policy
638 # Run the appropriate keyword.
639 ${currentPolicy}= Run Keyword @{cmd_buf}
640
George Keishing409df052024-01-17 22:36:14 +0530641 RETURN ${currentPolicy}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600642
643
644Set BMC Reset Reference Time
645 [Documentation] Set current boot time as a reference and increment
646 ... boot count.
647
648 ${cur_btime}= Get BMC Boot Time
649 Run Keyword If ${BOOT_TIME} == ${0} and ${BOOT_COUNT} == ${0}
650 ... Set Global Variable ${BOOT_TIME} ${cur_btime}
651 ... ELSE IF ${cur_btime} > ${BOOT_TIME}
652 ... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime}
653 ... AND
654 ... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1}
655
656
657Get BMC Boot Time
658 [Documentation] Returns boot time from /proc/stat.
659
660 Open Connection And Log In
661 ${output} ${stderr}=
662 ... Execute Command egrep '^btime ' /proc/stat | cut -f 2 -d ' '
663 ... return_stderr=True
664 Should Be Empty ${stderr}
665 ${btime}= Convert To Integer ${output}
George Keishing409df052024-01-17 22:36:14 +0530666 RETURN ${btime}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600667
668
669Enable Core Dump On BMC
670 [Documentation] Enable core dump collection.
671 ${core_pattern} ${stderr} ${rc}= BMC Execute Command
672 ... echo '/tmp/core_%e.%p' | tee /proc/sys/kernel/core_pattern
673 Should Be Equal As Strings ${core_pattern} /tmp/core_%e.%p
674
675
676Get Number Of BMC Core Dump Files
677 [Documentation] Returns number of core dump files on BMC.
678 Open Connection And Log In
679 ${num_of_core_dump}= Execute Command
680 ... ls /tmp/core* 2>/dev/null | wc -l
George Keishing409df052024-01-17 22:36:14 +0530681 RETURN ${num_of_core_dump}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600682
683
684Set Core Dump File Size Unlimited
685 [Documentation] Set core dump file size to unlimited.
686 BMC Execute Command ulimit -c unlimited
687
688
689Check For Core Dumps
690 [Documentation] Check for any core dumps exist.
691 ${output}= Get Number Of BMC Core Dump Files
692 Run Keyword If ${output} > 0
693 ... Log **Warning** BMC core dump files exist level=WARN
694
695
696Configure Initial Settings
697 [Documentation] Restore old IP and route.
698 ... This keyword requires initial settings viz IP address,
George Keishing16b3c7b2021-01-28 09:23:37 -0600699 ... Network Mask, default gateway and serial console IP and port
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600700 ... information which should be provided in command line.
701
702 [Arguments] ${host}=${OPENBMC_HOST} ${mask}=${NET_MASK}
703 ... ${gw_ip}=${GW_IP}
704
705 # Description of arguments:
706 # host IP address of the OS Host.
707 # mask Network mask.
708 # gu_ip Gateway IP address or hostname.
709
710 # Open telnet connection and ignore the error, in case telnet session is
711 # already opened by the program calling this keyword.
712 Run Keyword And Ignore Error Open Telnet Connection to BMC Serial Console
713 Telnet.write ifconfig eth0 ${host} netmask ${mask}
714 Telnet.write route add default gw ${gw_ip}
715
716
717Install Debug Tarball On BMC
718 [Documentation] Copy the debug tar file to BMC and install.
719 [Arguments] ${tarball_file_path}=${default_tarball}
720 ... ${targ_tarball_dir_path}=/tmp/tarball/
721
722 # Description of arguments:
723 # tarball_file_path Path of the debug tarball file.
724 # The tar file is downloaded from the build page
George Keishinged616122020-07-02 00:57:15 -0500725 # https://jenkins.openbmc.org/job/latest-master/
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600726 # obmc-phosphor-debug-tarball-witherspoon.tar.xz
727 #
728 # targ_tarball_dir_path The directory path where the tarball is to be
729 # installed.
730
731 OperatingSystem.File Should Exist ${tarball_file_path}
732 ... msg=${tarball_file_path} doesn't exist.
733
734 # Upload the file to BMC.
George Keishingb5c119e2025-03-25 20:45:03 +0530735 Import Library SCPLibrary AS scp
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600736 Open Connection for SCP
737 scp.Put File ${tarball_file_path} /tmp/debug-tarball.tar.xz
738
739 # Create tarball directory and install.
740 BMC Execute Command mkdir -p ${targ_tarball_dir_path}
741 BMC Execute Command
742 ... tar -xf /tmp/debug-tarball.tar.xz -C ${targ_tarball_dir_path}
743
744 # Remove the tarball file from BMC.
745 BMC Execute Command rm -f /tmp/debug-tarball.tar.xz
746
747
748Get BMC Boot Count
749 [Documentation] Returns BMC boot count based on boot time.
750 ${cur_btime}= Get BMC Boot Time
751
752 # Set global variable BOOT_TIME to current boot time if current boot time
753 # is changed. Also increase value of global variable BOOT_COUNT by 1.
754 Run Keyword If ${cur_btime} > ${BOOT_TIME}
755 ... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime}
756 ... AND
757 ... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1}
758
George Keishing409df052024-01-17 22:36:14 +0530759 RETURN ${BOOT_COUNT}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600760
761
762Set BMC Boot Count
763 [Documentation] Set BMC boot count to given value.
764 [Arguments] ${count}
765
766 # Description of arguments:
767 # count boot count value.
768 ${cur_btime}= Get BMC Boot Time
769
770 # Set global variable BOOT_COUNT to given value.
771 Set Global Variable ${BOOT_COUNT} ${count}
772
773 # Set BOOT_TIME variable to current boot time.
Tony Lee073fbc02020-05-12 15:12:16 +0800774 Set Global Variable ${BOOT_TIME} ${cur_btime}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600775
776
777Delete Error Log Entry
778 [Documentation] Delete error log entry.
Michael Sheposcc490b42020-08-26 12:53:01 -0500779 [Arguments] ${entry_path} ${quiet}=${0}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600780
781 # Description of argument(s):
Michael Sheposcc490b42020-08-26 12:53:01 -0500782 # quiet If enabled, turns off logging to console.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600783 # entry_path Delete an error log entry.
784 # Ex. /xyz/openbmc_project/logging/entry/1
785
786 # Skip delete if entry URI is a callout.
787 # Examples:
788 # /xyz/openbmc_project/logging/entry/1/callout
789 # /xyz/openbmc_project/logging/entry/1/callouts/0
790 ${callout_entry}= Run Keyword And Return Status
791 ... Should Match Regexp ${entry_path} /callout[s]?(/|$)
792 Return From Keyword If ${callout_entry}
793
794 ${data}= Create Dictionary data=@{EMPTY}
Michael Sheposcc490b42020-08-26 12:53:01 -0500795 ${resp}= Openbmc Delete Request ${entry_path} data=${data} quiet=${quiet}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600796 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
797
798
799Get BMC Version
800 [Documentation] Returns BMC version from /etc/os-release.
801 ... e.g. "v1.99.6-141-ge662190"
802
803 ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '='
804 ${output} ${stderr} ${rc}= BMC Execute Command ${cmd}
George Keishing409df052024-01-17 22:36:14 +0530805 RETURN ${output}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600806
807
808Get PNOR Version
809 [Documentation] Returns the PNOR version from the BMC.
810
811 ${pnor_attrs}= Get PNOR Attributes
George Keishing409df052024-01-17 22:36:14 +0530812 RETURN ${pnor_attrs['version']}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600813
814
815Get PNOR Attributes
816 [Documentation] Return PNOR software attributes as a dictionary.
817
818 # This keyword parses /var/lib/phosphor-software-manager/pnor/ro/pnor.toc
819 # into key/value pairs.
820
821 ${outbuf} ${stderr} ${rc}= BMC Execute Command
822 ... cat /var/lib/phosphor-software-manager/pnor/ro/pnor.toc
823 ${pnor_attrs}= Key Value Outbuf To Dict ${outbuf} delim==
824
George Keishing409df052024-01-17 22:36:14 +0530825 RETURN ${pnor_attrs}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600826
827
Sivas SRR17dae1a2019-03-24 23:52:02 -0500828GET BMC PNOR Version
829 [Documentation] Return BMC & PNOR version from openbmc shell.
830
831 ${bmc_version}= GET BMC Version
832 ${pnor_version}= GET PNOR Version
833 Log ${bmc_version}
834 Rprint Vars bmc_version
835 Log ${pnor_version}
836 Rprint Vars pnor_version
837
George Keishing409df052024-01-17 22:36:14 +0530838 RETURN ${bmc_version} ${pnor_version}
Sivas SRR17dae1a2019-03-24 23:52:02 -0500839
840
Sushil Singh5ea86d02019-07-11 02:05:16 -0500841Redfish Get BMC Version
842 [Documentation] Get BMC version via Redfish.
843
ganesanb4d430282023-04-27 14:33:23 +0000844 ${output}= Redfish.Get Attribute ${REDFISH_BASE_URI}Managers/${MANAGER_ID} FirmwareVersion
George Keishing409df052024-01-17 22:36:14 +0530845 RETURN ${output}
Sushil Singh5ea86d02019-07-11 02:05:16 -0500846
847Redfish Get Host Version
848 [Documentation] Get host version via Redfish.
849
Yi Huc32434a2024-01-11 17:33:10 -0800850 ${output}= Redfish.Get Attribute ${REDFISH_BASE_URI}Systems/${SYSTEM_ID} BiosVersion
George Keishing409df052024-01-17 22:36:14 +0530851 RETURN ${output}
Sushil Singh5ea86d02019-07-11 02:05:16 -0500852
853
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600854Copy Address Translation Utils To HOST OS
855 [Documentation] Copy address translation utils to host OS.
856
857 OperatingSystem.File Should Exist ${probe_cpu_tool_path}
858 ... msg=${probe_cpu_tool_path} doesn't exist.
859 OperatingSystem.File Should Exist ${probe_cpu_tool_path}
860 ... msg=${probe_cpu_tool_path} doesn't exist.
861
862 scp.Open connection ${OS_HOST} username=${OS_USERNAME}
863 ... password=${OS_PASSWORD}
864 scp.Put File ${probe_cpu_tool_path} ${target_file_path}
865 scp.Put File ${scom_addrs_tool_path} ${target_file_path}
866
867
868Verify BMC RTC And UTC Time Drift
869 [Documentation] Verify that the RTC and UTC time difference is less than
870 ... the given time_drift_max.
871 [Arguments] ${time_diff_max}=${10}
872
873 # Description of argument(s):
874 # time_diff_max The max allowable RTC and UTC time difference in seconds.
875
876 # Example:
877 # time_dict:
878 # [local_time]: Fri 2017-11-03 152756 UTC
879 # [local_time_seconds]: 1509740876
880 # [universal_time]: Fri 2017-11-03 152756 UTC
881 # [universal_time_seconds]: 1509740876
882 # [rtc_time]: Fri 2016-05-20 163403
883 # [rtc_time_seconds]: 1463780043
884 # [time_zone]: n/a (UTC, +0000)
885 # [network_time_on]: yes
886 # [ntp_synchronized]: no
887 # [rtc_in_local_tz]: no
888
889 ${time}= Get BMC Date Time
890 ${time_diff}= Evaluate
891 ... ${time['universal_time_seconds']} - ${time['rtc_time_seconds']}
892 Should Be True ${time_diff} < ${time_diff_max}
893
894
895Validate IP On BMC
896 [Documentation] Validate IP address is present in set of IP addresses.
897 [Arguments] ${ip_address} ${ip_data}
898
899 # Description of argument(s):
900 # ip_address IP address to check (e.g. xx.xx.xx.xx).
901 # ip_data Set of the IP addresses present.
902
903 Should Contain Match ${ip_data} ${ip_address}/*
904 ... msg=${ip_address} not found in the list provided.
905
906
907Remove Journald Logs
908 [Documentation] Remove all journald logs and restart service.
909
910 ${cmd}= Catenate systemctl stop systemd-journald.service &&
911 ... rm -rf /var/log/journal && systemctl start systemd-journald.service
912
913 BMC Execute Command ${cmd}
914
915
916Check For Regex In Journald
917 [Documentation] Parse the journal log and check for regex string.
918 [Arguments] ${regex}=${ERROR_REGEX} ${error_check}=${0} ${boot}=${EMPTY}
George Keishing140351f2022-03-10 08:10:01 -0600919 ... ${filter_string}=${EMPTY}
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600920
921 # Description of argument(s):
922 # regex Strings to be filter.
923 # error_check Check for errors.
924 # boot Argument to check current or persistent full boot log
925 # (e.g. "-b").
George Keishing140351f2022-03-10 08:10:01 -0600926 # filter_string String to be stripped out.
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600927
George Keishing140351f2022-03-10 08:10:01 -0600928
929 ${cmd} = Run Keyword If '${filter_string}' == '${EMPTY}'
930 ... Catenate journalctl --no-pager ${boot} | egrep '${regex}'
931 ... ELSE
932 ... Catenate journalctl --no-pager ${boot} | egrep '${regex}' | sed '/${filter_string}/d'
933
934 ${journal_log} ${stderr} ${rc}= BMC Execute Command ${cmd} ignore_err=1
Steven Sombarf60cbcf2018-12-07 08:12:18 -0600935
936 Run Keyword If ${error_check} == ${0}
937 ... Should Be Empty ${journal_log}
938 ... ELSE
939 ... Should Not Be Empty ${journal_log}
940
941
942Get Service Attribute
943 [Documentation] Get service attribute policy output.
944 [Arguments] ${option} ${servicename}
945
946 # Description of argument(s):
947 # option systemctl supported options
948 # servicename Qualified service name
949 ${cmd}= Set Variable
950 ... systemctl -p ${option} show ${servicename} | cut -d = -f2
951 ${attr} ${stderr} ${rc}= BMC Execute Command ${cmd}
George Keishing409df052024-01-17 22:36:14 +0530952 RETURN ${attr}
Anusha Dathatrieda09492019-02-26 08:30:13 -0600953
954
955Verify Watchdog Enabled
956 [Documentation] Check that watchdog settings are enabled.
957
958 ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0
959 Should Be Equal As Strings ${properties["Enabled"]} ${True}
960 Should Not Be Equal As Strings ${properties["TimeRemaining"]} 0
Ashwini Chandrappa233d9652021-08-04 09:56:30 -0500961
962
963Is BMC Unpingable
964 [Documentation] Check if BMC is unpingable.
965
966 ${RC} ${output}= Run and return RC and Output ping -c 4 ${OPENBMC_HOST}
967 Log RC: ${RC}\nOutput:\n${output}
968 Should be equal ${RC} ${1}
Sushil Singh6d170ad2022-11-28 07:04:50 -0600969
Sushil Singh84c80152023-02-06 02:02:48 -0600970
Nagarjun B011c5f32023-07-17 17:14:59 +0530971Is Host Unpingable
972 [Documentation] Check if Given IP is unpingable.
973 [Arguments] ${ip}
974
975 # Description of argument(s):
976 # ip HostOS IP address (e.g. "10.7.7.7").
977
978 ${RC} ${output}= Run and return RC and Output ping -c 4 ${ip}
979 Log RC: ${RC}\nOutput:\n${output}
980 Should be equal ${RC} ${1}
981
982
Sushil Singh84c80152023-02-06 02:02:48 -0600983Redfish BMC Match States
984 [Documentation] Verify the BMC match state.
985 [Arguments] ${match_state}
986
987 # Description of argument(s):
988 # match_state Match the state of BMC.
989
990 ${bmc_state}= Redfish Get BMC State
991 Should Be Equal As Strings ${match_state} ${bmc_state}
992
993
Sushil Singh6d170ad2022-11-28 07:04:50 -0600994Kernel Panic BMC Reset Operation
995 [Documentation] Create kernel panic to reset BMC.
996
997 ${kernel_panic_cmd_file}= Set Variable /bin/sh -c "echo c > /proc/sysrq-trigger"
Sushil Singha83bba02023-01-18 08:43:45 -0600998 ${status}= Run Keyword And Return Status BMC Execute Command ${kernel_panic_cmd_file} time_out=20
Sushil Singh6d170ad2022-11-28 07:04:50 -0600999
George Keishing409df052024-01-17 22:36:14 +05301000 RETURN ${status}
Sushil Singh6d170ad2022-11-28 07:04:50 -06001001
Anusha Dathatrie444dcd2023-11-20 05:04:55 -06001002
1003Get Property Value Of Systemd Service In BMC
1004 [Documentation] Get property of systemd service in BMC.
1005 [Arguments] ${service_name} ${property_name}
1006
1007 # Description of argument(s):
1008 # service_name Systemd service name. E.g. bmcweb etc.
1009 # property_name Property name. E.g. MainPID etc.
1010
1011 # ~# systemctl show --property MainPID --value bmcweb
1012 # 1273
1013
1014 ${stdout} ${stderr} ${rc}= BMC Execute Command
1015 ... systemctl show --property ${property_name} --value ${service_name}
1016
George Keishing409df052024-01-17 22:36:14 +05301017 RETURN ${stdout}