Coding guidelines cleanup of utils.robot
Update utils.robot to better match coding guidelines.
Resolves openbmc/openbmc-test-automation#1212
Change-Id: Ie82166e19663fd94b5335e4202f56f07cc1d7013
Signed-off-by: Steven Sombar <ssombar@us.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index efe7cc4..2ce76e3 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1,4 +1,7 @@
*** Settings ***
+
+Documentation Utilities for Robot keywords.
+
Resource ../lib/resource.txt
Resource ../lib/rest_client.robot
Resource ../lib/connection_client.robot
@@ -16,22 +19,24 @@
Library SCPLibrary WITH NAME scp
*** Variables ***
-${pflash_cmd} /usr/sbin/pflash -r /dev/stdout -P VERSION
-${SYSTEM_SHUTDOWN_TIME} ${5}
+
+${pflash_cmd} /usr/sbin/pflash -r /dev/stdout -P VERSION
+${SYSTEM_SHUTDOWN_TIME} ${5}
+
${dbuscmdBase}
... dbus-send --system --print-reply --dest=${OPENBMC_BASE_DBUS}.settings.Host
${dbuscmdGet}
... ${SETTINGS_URI}host0 org.freedesktop.DBus.Properties.Get
-# Enable when ready with openbmc/openbmc-test-automation#203
-#${dbuscmdString}= string:"xyz.openbmc_project.settings.Host" string:
-${dbuscmdString}= string:"org.openbmc.settings.Host" string:
+${dbuscmdString}= string:"xyz.openbmc_project.settings.Host" string:
# Assign default value to QUIET for programs which may not define it.
${QUIET} ${0}
+
${bmc_mem_free_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f4
${bmc_mem_total_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f2
${bmc_cpu_usage_cmd}= top -n 1 | grep CPU: | cut -c 7-9
${HOST_SETTING} ${SETTINGS_URI}host0
+
# /run/initramfs/ro associate filesystem should be 100% full always
${bmc_file_system_usage_cmd}= df -h | cut -c 52-54 | grep 100 | wc -l
${total_pnor_ro_file_system_cmd}= df -h | grep /media/pnor-ro | wc -l
@@ -45,18 +50,20 @@
# Initialize default debug value to 0.
${DEBUG} ${0}
+${probe_cpu_tool_path} ${EXECDIR}/tools/ras/probe_cpus.sh
+${scom_addrs_tool_path} ${EXECDIR}/tools/ras/scom_addr_p9.sh
+${target_file_path} /root/
+
+${default_tarball} ${EXECDIR}/obmc-phosphor-debug-tarball-witherspoon.tar.xz
+
# These variables are used to straddle between new and old methods of setting
# values.
-${boot_prog_method} ${EMPTY}
-
+${boot_prog_method} ${EMPTY}
${power_policy_setup} ${0}
${bmc_power_policy_method} ${EMPTY}
@{valid_power_policy_vars} RESTORE_LAST_STATE ALWAYS_POWER_ON
... ALWAYS_POWER_OFF
-${probe_cpu_tool_path} ${EXECDIR}/tools/ras/probe_cpus.sh
-${scom_addrs_tool_path} ${EXECDIR}/tools/ras/scom_addr_p9.sh
-${target_file_path} /root/
*** Keywords ***
@@ -67,6 +74,7 @@
Check BMC Mem Performance
Check BMC File System Performance
+
Verify PNOR Update
[Documentation] Verify that the PNOR is not corrupted.
# Example:
@@ -77,43 +85,60 @@
${pnor_info}= Execute Command On BMC ${pflash_cmd}
Should Not Contain Any ${pnor_info} Flash header not found Error
+
Get BMC System Model
- [Documentation] Get the BMC model from the device tree.
+ [Documentation] Get the BMC model from the device tree and return it.
${bmc_model} ${stderr} ${rc}= BMC Execute Command
... cat ${devicetree_base} | cut -d " " -f 1 return_stderr=True
... test_mode=0
Should Be Empty ${stderr}
- Should Not Be Empty ${bmc_model}
+ Should Not Be Empty ${bmc_model} msg=BMC model is empty.
[Return] ${bmc_model}
+
Verify BMC System Model
[Documentation] Verify the BMC model with ${OPENBMC_MODEL}.
[Arguments] ${bmc_model}
+ # Description of argument(s):
+ # bmc_model System model (e.g. "witherspoon").
+
${tmp_bmc_model}= Fetch From Right ${OPENBMC_MODEL} /
${tmp_bmc_model}= Fetch From Left ${tmp_bmc_model} .
${ret}= Run Keyword And Return Status Should Contain ${bmc_model}
... ${tmp_bmc_model} ignore_case=True
[Return] ${ret}
+
Wait For Host To Ping
[Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}min
... ${interval}=5 sec
- # host The DNS name or IP of the host to ping.
- # timeout The amount of time after which attempts to ping cease.
+ # Description of argument(s):
+ # host The host name or IP of the host to ping.
+ # timeout The amount of time after which ping attempts cease.
+ # This should be expressed in Robot Framework's time format
+ # (e.g. "10 seconds").
# interval The amount of time in between attempts to ping.
+ # This should be expressed in Robot Framework's time format
+ # (e.g. "5 seconds").
Wait Until Keyword Succeeds ${timeout} ${interval} Ping Host ${host}
+
Ping Host
[Arguments] ${host}
+
+ # Description of argument(s):
+ # host The host name or IP of the host to ping.
+
Should Not Be Empty ${host} msg=No host provided
${RC} ${output}= Run and return RC and Output ping -c 4 ${host}
Log RC: ${RC}\nOutput:\n${output}
Should be equal ${RC} ${0}
+
Get Boot Progress
[Documentation] Get the boot progress and return it.
[Arguments] ${quiet}=${QUIET}
@@ -130,6 +155,7 @@
[Return] ${state}
+
Set Boot Progress Method
[Documentation] Set the boot_prog_method to either 'Old' or 'New'.
@@ -162,6 +188,7 @@
Set Global Variable ${boot_prog_method} Old
Rqpvars boot_prog_method
+
Old Get Boot Progress
[Documentation] Get the boot progress the old way (via org location).
[Arguments] ${quiet}=${QUIET}
@@ -175,6 +202,7 @@
[Return] ${state}
+
New Get Boot Progress
[Documentation] Get the boot progress the new way (via xyz location).
[Arguments] ${quiet}=${QUIET}
@@ -187,19 +215,26 @@
[Return] ${state.rsplit('.', 1)[1]}
+
Is Power On
${state}= Get Power State
Should be equal ${state} ${1}
+
Is Power Off
${state}= Get Power State
Should be equal ${state} ${0}
+
Initiate Power On
[Documentation] Initiates the power on and waits until the Is Power On
... keyword returns that the power state has switched to on.
[Arguments] ${wait}=${1}
+ # Description of argument(s):
+ # wait Indicates whether to wait for a powered on state after issuing
+ # the power on command.
+
@{arglist}= Create List
${args}= Create Dictionary data=@{arglist}
${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn
@@ -210,9 +245,11 @@
Run Keyword If '${wait}' == '${0}' Return From Keyword
Wait Until Keyword Succeeds 3 min 10 sec Is Power On
+
Initiate Power Off
[Documentation] Initiates the power off and waits until the Is Power Off
... keyword returns that the power state has switched to off.
+
@{arglist}= Create List
${args}= Create Dictionary data=@{arglist}
${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff
@@ -220,6 +257,7 @@
should be equal as strings ${resp.status_code} ${HTTP_OK}
Wait Until Keyword Succeeds 1 min 10 sec Is Power Off
+
Initiate OS Host Power Off
[Documentation] Initiate an OS reboot.
[Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
@@ -242,6 +280,7 @@
${output} ${stderr} ${rc}= OS Execute Command
... ${cmd_buf} fork=${1}
+
Initiate OS Host Reboot
[Documentation] Initiate an OS reboot.
[Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
@@ -260,6 +299,7 @@
${output} ${stderr} ${rc}= OS Execute Command
... ${cmd_buf} fork=${1}
+
Initiate Auto Reboot
[Documentation] Initiate an auto reboot.
@@ -268,7 +308,10 @@
# Set the watchdog timer. Note: 5000 = milliseconds which is 5 seconds.
Trigger Host Watchdog Error 5000
+
Trigger Warm Reset
+ [Documentation] Initiate a warm reset.
+
log to console "Triggering warm reset"
${data}= create dictionary data=@{EMPTY}
${resp}= openbmc post request
@@ -281,6 +324,7 @@
Sleep ${SYSTEM_SHUTDOWN_TIME}min
Check If BMC Is Up
+
Check OS
[Documentation] Attempts to ping the host OS and then checks that the host
... OS is up by running an SSH command.
@@ -290,6 +334,7 @@
... ${print_string}=${EMPTY}
[Teardown] SSHLibrary.Close Connection
+ # Description of argument(s):
# os_host The DNS name/IP of the OS host associated with our BMC.
# os_username The username to be used to sign on to the OS host.
# os_password The password to be used to sign on to the OS host.
@@ -329,6 +374,7 @@
# ping
Should Be Equal As Strings ${ping_rc} ${TRUE} msg=${err_msg}
+
Wait for OS
[Documentation] Waits for the host OS to come up via calls to "Check OS".
[Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
@@ -336,6 +382,7 @@
... ${quiet}=${0}
[Teardown] rprintn
+ # Description of argument(s):
# os_host The DNS name or IP of the OS host associated with our
# BMC.
# os_username The username to be used to sign on to the OS host.
@@ -364,6 +411,10 @@
[Documentation] Returns the power state as an integer. Either 0 or 1.
[Arguments] ${quiet}=${QUIET}
+ # Description of argument(s):
+ # quiet Indicates whether this keyword should run without any output to
+ # the console.
+
@{arglist}= Create List
${args}= Create Dictionary data=@{arglist}
@@ -371,6 +422,7 @@
... data=${args} quiet=${quiet}
Should be equal as strings ${resp.status_code} ${HTTP_OK}
${content}= to json ${resp.content}
+
[Return] ${content["data"]}
@@ -390,9 +442,15 @@
Log Copying ${PNOR_IMAGE_PATH} to /tmp
scp.Put File ${PNOR_IMAGE_PATH} /tmp
+
Flash PNOR
[Documentation] Calls flash bios update method to flash PNOR image
[Arguments] ${pnor_image}
+
+ # Description of argument(s):
+ # pnor_image The filename and path of the PNOR image
+ # (e.g. "/home/image/zaius.pnor").
+
@{arglist}= Create List ${pnor_image}
${args}= Create Dictionary data=@{arglist}
${resp}= Call Method /org/openbmc/control/flash/bios/ update
@@ -400,18 +458,21 @@
should be equal as strings ${resp.status_code} ${HTTP_OK}
Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing
+
Get Flash BIOS Status
[Documentation] Returns the status of the flash BIOS API as a string. For
... example 'Flashing', 'Flash Done', etc
${data}= Read Properties /org/openbmc/control/flash/bios
[Return] ${data['status']}
+
Is PNOR Flashing
[Documentation] Get BIOS 'Flashing' status. This indicates that PNOR
... flashing has started.
${status}= Get Flash BIOS Status
Should Contain ${status} Flashing
+
Is PNOR Flash Done
[Documentation] Get BIOS 'Flash Done' status. This indicates that the
... PNOR flashing has completed.
@@ -424,11 +485,13 @@
${boot_progress}= Get Boot Progress
Should Be Equal ${boot_progress} OSStart
+
Is OS Off
[Documentation] Check if boot progress is "Off".
${boot_progress}= Get Boot Progress
Should Be Equal ${boot_progress} Off
+
Get Boot Progress To OS Starting State
[Documentation] Get the system to a boot progress state of 'FW Progress,
... Starting OS'.
@@ -440,6 +503,7 @@
... Run Keywords Initiate Host PowerOff AND Initiate Host Boot
... AND Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting
+
Verify Ping and REST Authentication
${l_ping}= Run Keyword And Return Status
... Ping Host ${OPENBMC_HOST}
@@ -456,6 +520,7 @@
${system} ${stderr}= Execute Command hostname return_stderr=True
Should Be Empty ${stderr}
+
Check If BMC is Up
[Documentation] Wait for Host to be online. Checks every X seconds
... interval for Y minutes and fails if timed out.
@@ -463,6 +528,14 @@
[Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min
... ${interval}=10 sec
+ # Description of argument(s):
+ # max_timeout Maximum time to wait.
+ # This should be expressed in Robot Framework's time format
+ # (e.g. "10 minutes").
+ # interfal Interval to wait between status checks.
+ # This should be expressed in Robot Framework's time format
+ # (e.g. "5 seconds").
+
Wait Until Keyword Succeeds
... ${max_timeout} ${interval} Verify Ping and REST Authentication
@@ -480,17 +553,24 @@
Return From Keyword If '${alive}' == '${False}' ${False}
[Return] ${True}
+
Flush REST Sessions
[Documentation] Removes all the active session objects
Delete All Sessions
+
Initialize DBUS cmd
[Documentation] Initialize dbus string with property string to extract
[Arguments] ${boot_property}
+
+ # Description of argument(s):
+ # boot_property Property string.
+
${cmd}= Catenate ${dbuscmdBase} ${dbuscmdGet} ${dbuscmdString}
${cmd}= Catenate ${cmd}${boot_property}
Set Global Variable ${dbuscmd} ${cmd}
+
Create OS Console File Path
[Documentation] Create OS console file path name and return it.
[Arguments] ${log_file_path}=${EMPTY}
@@ -507,23 +587,27 @@
[Return] ${log_file_path}
+
Create OS Console Command String
[Documentation] Return a command string to start OS console logging.
# First make sure that the ssh_pw program is available.
- ${cmd_buf}= Catenate which ssh_pw 2>/dev/null || find ${EXECDIR} -name 'ssh_pw'
- Rdpissuing ${cmd_buf}
- ${rc} ${output}= Run And Return Rc And Output ${cmd_buf}
+ ${cmd}= Catenate which ssh_pw 2>/dev/null || find
+ ... ${EXECDIR} -name 'ssh_pw'
+
+ Rdpissuing ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
Rdpvars rc output
Should Be Equal As Integers 0 ${rc} msg=Could not find ssh_pw.
${ssh_pw_file_path}= Set Variable ${output}
- ${cmd_buf}= Catenate ${ssh_pw_file_path} ${OPENBMC_PASSWORD} -p 2200
+ ${cmd}= Catenate ${ssh_pw_file_path} ${OPENBMC_PASSWORD} -p 2200
... -o "StrictHostKeyChecking no" ${OPENBMC_USERNAME}@${OPENBMC_HOST}
- [Return] ${cmd_buf}
+ [Return] ${cmd}
+
Get SOL Console Pid
[Documentation] Get the pid of the active SOL console job.
@@ -600,6 +684,7 @@
[Return] ${output}
+
Start SOL Console Logging
[Documentation] Start system console log to file.
[Arguments] ${log_file_path}=${EMPTY} ${return_data}=${1}
@@ -657,7 +742,8 @@
... The File is appended with datetime.
[Arguments] ${file_path}=/tmp/journal_log
- Open Connection And Log In
+ # Description of arguments:
+ # file_path The file path of the journal file.
${cur_time}= Get Time Stamp
Set Global Variable ${LOG_TIME} ${cur_time}
@@ -672,6 +758,9 @@
... user input location.
[Arguments] ${file_path}=/tmp/journal_log
+ # Description of arguments:
+ # file_path The file path of the journal file.
+
Open Connection And Log In
${rc}=
@@ -699,6 +788,7 @@
[Return] ${journal_log}
+
Mac Address To Hex String
[Documentation] Converts MAC address into hex format.
... Example
@@ -709,19 +799,23 @@
... 00:01:6C:80:02:78
[Arguments] ${i_macaddress}
+ # Description of arguments:
+ # i_macaddress The MAC address.
+
${mac_hex}= Catenate 0x${i_macaddress.replace(':', ' 0x')}
[Return] ${mac_hex}
+
IP Address To Hex String
[Documentation] Converts IP address into hex format.
... Example:
... Given the following IP: 10.3.164.100
... This keyword will return: 0xa 0x3 0xa4 0xa0
- ... Description of arguments:
- ... i_ipaddress IP address in the following format
- ... 10.10.10.10
[Arguments] ${i_ipaddress}
+ # Description of arguments:
+ # i_macaddress The IP address in the format 10.10.10.10.
+
@{ip}= Split String ${i_ipaddress} .
${index}= Set Variable ${0}
@@ -730,8 +824,10 @@
\ Set List Value ${ip} ${index} ${hex}
\ ${index}= Set Variable ${index + 1}
${ip_hex}= Catenate @{ip}
+
[Return] ${ip_hex}
+
BMC CPU Performance Check
[Documentation] Minimal 10% of proc should be free in this instance
@@ -742,6 +838,7 @@
${bmc_cpu_percentage}= Fetch From Left ${bmc_cpu_usage_output} %
Should be true ${bmc_cpu_percentage} < 90
+
BMC Mem Performance Check
[Documentation] Minimal 10% of memory should be free in this instance
@@ -761,15 +858,16 @@
... ${bmc_mem_percentage}/${bmc_mem_total_output}
Should be true ${bmc_mem_percentage} > 10
+
BMC File System Usage Check
[Documentation] Check the file system space. 4 file system should be
... 100% full which is expected
- # Filesystem Size Used Available Use% Mounted on
- # /dev/root 14.4M 14.4M 0 100% /
- # /dev/ubiblock0_0 14.4M 14.4M 0 100% /media/rofs-c9249b0e
- # /dev/ubiblock8_0 19.6M 19.6M 0 100% /media/pnor-ro-8764baa3
- # /dev/ubiblock4_0 14.4M 14.4M 0 100% /media/rofs-407816c
- # /dev/ubiblock8_4 21.1M 21.1M 0 100% /media/pnor-ro-cecc64c4
+ # Filesystem Size Used Available Use% Mounted on
+ # /dev/root 14.4M 14.4M 0 100% /
+ # /dev/ubiblock0_0 14.4M 14.4M 0 100% /media/rofs-c9249b0e
+ # /dev/ubiblock8_0 19.6M 19.6M 0 100% /media/pnor-ro-8764baa3
+ # /dev/ubiblock4_0 14.4M 14.4M 0 100% /media/rofs-407816c
+ # /dev/ubiblock8_4 21.1M 21.1M 0 100% /media/pnor-ro-cecc64c4
${bmc_fs_usage_output} ${stderr} ${rc}= BMC Execute Command
... ${bmc_file_system_usage_cmd}
${bmc_pnor_fs_usage_output} ${stderr} ${rc}= BMC Execute Command
@@ -782,34 +880,41 @@
${total_full_fs}= Evaluate ${total_bmc_pnor_image}+1
Should Be True ${bmc_fs_usage_output}==${total_full_fs}
+
Check BMC CPU Performance
[Documentation] Minimal 10% of proc should be free in 3 sample
:FOR ${var} IN Range 1 4
\ BMC CPU Performance check
+
Check BMC Mem Performance
[Documentation] Minimal 10% of memory should be free
:FOR ${var} IN Range 1 4
\ BMC Mem Performance check
+
Check BMC File System Performance
[Documentation] Check for file system usage for 4 times
:FOR ${var} IN Range 1 4
\ BMC File System Usage check
+
Get URL List
[Documentation] Return list of URLs under given URL.
[Arguments] ${openbmc_url}
+
# Description of argument(s):
# openbmc_url URL for list operation (e.g.
# /xyz/openbmc_project/inventory).
${url_list}= Read Properties ${openbmc_url}/list quiet=${1}
Sort List ${url_list}
+
[Return] ${url_list}
+
Get Endpoint Paths
[Documentation] Returns all url paths ending with given endpoint
... Example:
@@ -818,11 +923,12 @@
... cpu -
... /org/openbmc/inventory/system/chassis/motherboard/cpu0,
... /org/openbmc/inventory/system/chassis/motherboard/cpu1
- ... Description of arguments:
- ... path URL path for enumeration
- ... endpoint string for which url path ending
[Arguments] ${path} ${endpoint}
+ # Description of arguments:
+ # path URL path for enumeration.
+ # endpoint Endpoint string (url path ending).
+
${resp}= Read Properties ${path}/enumerate timeout=30
Log Dictionary ${resp}
@@ -831,8 +937,10 @@
# Start of string followed by zero or more of any character followed by
# any digit or lower case character.
${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}[0-9a-z]*$
+
[Return] ${resp}
+
Check Zombie Process
[Documentation] Check if any defunct process exist or not on BMC
${count} ${stderr} ${rc}= Execute Command ps -o stat | grep Z | wc -l
@@ -840,6 +948,7 @@
Should Be True ${count}==0
Should Be Empty ${stderr}
+
Prune Journal Log
[Documentation] Prune archived journal logs.
[Arguments] ${vacuum_size}=1M
@@ -849,6 +958,9 @@
# This command will retain only the latest logs
# of the user specified size.
+ # Description of argument(s):
+ # vacuum_size Size of journal.
+
Open Connection And Log In
${output} ${stderr} ${rc}=
... Execute Command
@@ -857,6 +969,7 @@
Should Be Equal ${rc} ${0} msg=${stderr}
+
Set BMC Power Policy
[Documentation] Set the given BMC power policy.
[Arguments] ${policy}
@@ -878,6 +991,7 @@
${currentPolicy}= Get System Power Policy
Should Be Equal ${currentPolicy} ${policy}
+
New Set Power Policy
[Documentation] Set the given BMC power policy (new method).
[Arguments] ${policy}
@@ -889,6 +1003,7 @@
Write Attribute
... ${POWER_RESTORE_URI} PowerRestorePolicy data=${valueDict}
+
Old Set Power Policy
[Documentation] Set the given BMC power policy (old method).
[Arguments] ${policy}
@@ -899,35 +1014,46 @@
${valueDict}= create dictionary data=${policy}
Write Attribute ${HOST_SETTING} power_policy data=${valueDict}
+
Get System Power Policy
- [Documentation] Get the BMC power policy.
+ [Documentation] Returns the BMC power policy.
# Set the bmc_power_policy_method to either 'Old' or 'New'.
Set Power Policy Method
${cmd_buf}= Create List ${bmc_power_policy_method} Get Power Policy
# Run the appropriate keyword.
${currentPolicy}= Run Keyword @{cmd_buf}
+
[Return] ${currentPolicy}
+
New Get Power Policy
- [Documentation] Get the BMC power policy (new method).
+ [Documentation] Returns the BMC power policy (new method).
${currentPolicy}= Read Attribute ${POWER_RESTORE_URI} PowerRestorePolicy
+
[Return] ${currentPolicy}
+
Old Get Power Policy
- [Documentation] Get the BMC power policy (old method).
+ [Documentation] Returns the BMC power policy (old method).
${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
+
[Return] ${currentPolicy}
+
Get Auto Reboot
[Documentation] Returns auto reboot setting.
${setting}= Read Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot
+
[Return] ${setting}
+
Set Auto Reboot
[Documentation] Set the given auto reboot setting.
[Arguments] ${setting}
- # setting auto reboot's setting, i.e. 1 for enabling and 0 for disabling.
+
+ # Description of argument(s):
+ # setting The reboot setting, 1 for enabling and 0 for disabling.
${valueDict}= Set Variable ${setting}
${data}= Create Dictionary data=${valueDict}
@@ -948,8 +1074,9 @@
... AND
... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1}
+
Get BMC Boot Time
- [Documentation] Get boot time from /proc/stat.
+ [Documentation] Returns boot time from /proc/stat.
Open Connection And Log In
${output} ${stderr}=
@@ -959,9 +1086,14 @@
${btime}= Convert To Integer ${output}
[Return] ${btime}
+
Execute Command On BMC
[Documentation] Execute given command on BMC and return output.
[Arguments] ${command}
+
+ # Description of argument(s):
+ # command The command to execute on the BMC.
+
${stdout} ${stderr}= Execute Command ${command} return_stderr=True
Should Be Empty ${stderr}
[Return] ${stdout}
@@ -974,28 +1106,33 @@
... echo '/tmp/core_%e.%p' | tee /proc/sys/kernel/core_pattern
Should Be Equal As Strings ${core_pattern} /tmp/core_%e.%p
+
Get Number Of BMC Core Dump Files
- [Documentation] Get number of core dump files on BMC.
+ [Documentation] Returns number of core dump files on BMC.
Open Connection And Log In
${num_of_core_dump}= Execute Command
... ls /tmp/core* 2>/dev/null | wc -l
[Return] ${num_of_core_dump}
+
Set Core Dump File Size Unlimited
[Documentation] Set core dump file size to unlimited.
Open Connection And Log In
Execute Command On BMC
... ulimit -c unlimited
+
Check For Core Dumps
[Documentation] Check for any core dumps exist.
${output}= Get Number Of BMC Core Dump Files
Run Keyword If ${output} > 0
... Log **Warning** BMC core dump files exist level=WARN
+
Trigger Host Watchdog Error
[Documentation] Inject host watchdog timeout error via REST.
[Arguments] ${milliseconds}=1000 ${sleep_time}=5s
+
# Description of argument(s):
# milliseconds The time watchdog timer value in milliseconds (e.g. 1000 =
# 1 second).
@@ -1011,10 +1148,12 @@
Sleep ${sleep_time}
+
Login To OS Host
- [Documentation] Login to OS Host.
+ [Documentation] Login to OS Host and return the Login response code.
[Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME}
... ${os_password}=${OS_PASSWORD}
+
# Description of arguments:
# ${os_host} IP address of the OS Host.
# ${os_username} OS Host Login user name.
@@ -1030,6 +1169,7 @@
${resp}= Login ${os_username} ${os_password}
[Return] ${resp}
+
Configure Initial Settings
[Documentation] Restore old IP and route.
... This keyword requires initial settings viz IP address,
@@ -1039,17 +1179,22 @@
[Arguments] ${host}=${OPENBMC_HOST} ${mask}=${NET_MASK}
... ${gw_ip}=${GW_IP}
+ # Description of arguments:
+ # host IP address of the OS Host.
+ # mask Network mask.
+ # gu_ip Gateway IP address or hostname.
+
# Open telnet connection and ignore the error, in case telnet session is
# already opened by the program calling this keyword.
-
Run Keyword And Ignore Error Open Telnet Connection to BMC Serial Console
Telnet.write ifconfig eth0 ${host} netmask ${mask}
Telnet.write route add default gw ${gw_ip}
+
Install Debug Tarball On BMC
[Documentation] Copy the debug tar file to BMC and install.
- [Arguments] ${tarball_file_path}=${EXECDIR}/obmc-phosphor-debug-tarball-witherspoon.tar.xz
- ... ${targ_tarball_dir_path}=/tmp/tarball/
+ [Arguments] ${tarball_file_path}=${default_tarball}
+ ... ${targ_tarball_dir_path}=/tmp/tarball/
# Description of arguments:
# tarball_file_path Path of the debug tarball file.
@@ -1078,7 +1223,7 @@
Get BMC Boot Count
- [Documentation] Get BMC boot count based on boot time.
+ [Documentation] Returns BMC boot count based on boot time.
${cur_btime}= Get BMC Boot Time
# Set global variable BOOT_TIME to current boot time if current boot time
@@ -1087,8 +1232,10 @@
... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime}
... AND
... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1}
+
[Return] ${BOOT_COUNT}
+
Set BMC Boot Count
[Documentation] Set BMC boot count to given value.
[Arguments] ${count}
@@ -1103,6 +1250,7 @@
# Set BOOT_TIME variable to current boot time.
Set Global Variable ${BOOT_COUNT} ${count}
+
Get System LED State
[Documentation] Return the state of given system LED.
[Arguments] ${led_name}
@@ -1156,10 +1304,12 @@
Get LED State XYZ
[Documentation] Returns state of given LED.
[Arguments] ${led_name}
+
# Description of argument(s):
- # led_name Name of LED
+ # led_name Name of LED.
${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted
+ # Returns the state of the LED, either On or Off.
[Return] ${state}
@@ -1174,7 +1324,7 @@
Get PNOR Version
- [Documentation] Get the PNOR version from the BMC.
+ [Documentation] Returns the PNOR version from the BMC.
${pnor_attrs}= Get PNOR Attributes
[Return] ${pnor_attrs['version']}
@@ -1213,12 +1363,14 @@
Set Turbo Setting Via REST
[Documentation] Set turbo setting via REST.
[Arguments] ${setting}
+
# Description of argument(s):
- # setting Value which needs to be set.(i.e. False or True)
+ # setting Value which needs to be set.(i.e. False or True).
${valueDict}= Create Dictionary data=${setting}
Write Attribute ${SENSORS_URI}host/TurboAllowed value data=${valueDict}
+
Set Control Boot Mode
[Documentation] Set given boot mode on the boot object path attribute.
[Arguments] ${boot_path} ${boot_mode}
@@ -1235,6 +1387,7 @@
${valueDict}= Create Dictionary data=${boot_mode}
Write Attribute ${boot_path} BootMode data=${valueDict}
+
Copy Address Translation Utils To HOST OS
[Documentation] Copy address translation utils to host OS.
@@ -1270,9 +1423,7 @@
# [ntp_synchronized]: no
# [rtc_in_local_tz]: no
- ${bmc_time}= Get BMC Date Time
+ ${time}= Get BMC Date Time
${time_diff}= Evaluate
- ... ${bmc_time['universal_time_seconds']} - ${bmc_time['rtc_time_seconds']}
+ ... ${time['universal_time_seconds']} - ${time['rtc_time_seconds']}
Should Be True ${time_diff} < ${time_diff_max}
-
-