Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Resource ../lib/resource.txt |
| 3 | Resource ../lib/rest_client.robot |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 4 | Resource ../lib/connection_client.robot |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 5 | Library DateTime |
| 6 | Library Process |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 7 | Library OperatingSystem |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 8 | Library gen_print.py |
| 9 | Library gen_robot_print.py |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 10 | Library gen_cmd.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
| 12 | *** Variables *** |
| 13 | ${SYSTEM_SHUTDOWN_TIME} ${5} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 14 | ${dbuscmdBase} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 15 | ... dbus-send --system --print-reply --dest=${OPENBMC_BASE_DBUS}.settings.Host |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 16 | ${dbuscmdGet} |
George Keishing | 9485af9 | 2017-01-04 10:21:43 -0600 | [diff] [blame] | 17 | ... ${SETTINGS_URI}host0 org.freedesktop.DBus.Properties.Get |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 18 | # Enable when ready with openbmc/openbmc-test-automation#203 |
| 19 | #${dbuscmdString}= string:"xyz.openbmc_project.settings.Host" string: |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 20 | ${dbuscmdString}= string:"org.openbmc.settings.Host" string: |
| 21 | |
| 22 | # Assign default value to QUIET for programs which may not define it. |
| 23 | ${QUIET} ${0} |
Sivas SRR | ea85d1f | 2016-11-13 22:44:28 -0600 | [diff] [blame] | 24 | ${bmc_mem_free_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f4 |
| 25 | ${bmc_mem_total_cmd}= free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f2 |
| 26 | ${bmc_cpu_usage_cmd}= top -n 1 | grep CPU: | cut -c 7-9 |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 27 | ${HOST_SETTING} ${SETTINGS_URI}host0 |
Sivas SRR | 352bc16 | 2017-02-13 22:12:29 -0600 | [diff] [blame] | 28 | # /run/initramfs/ro associate filesystem should be 100% full always |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 29 | ${bmc_file_system_usage_cmd}= |
Sivas SRR | 352bc16 | 2017-02-13 22:12:29 -0600 | [diff] [blame] | 30 | ... df -h | grep -v /run/initramfs/ro | cut -c 52-54 | grep 100 | wc -l |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 32 | ${BOOT_TIME} ${0} |
| 33 | ${BOOT_COUNT} ${0} |
Sweta Potthuri | 025e012 | 2017-02-21 00:42:48 -0600 | [diff] [blame] | 34 | ${count} ${0} |
Sivas SRR | 8254db6 | 2017-02-07 09:39:46 -0600 | [diff] [blame] | 35 | ${devicetree_base} /sys/firmware/devicetree/base/model |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 36 | |
George Keishing | b7c9b54 | 2017-05-23 08:19:58 -0500 | [diff] [blame^] | 37 | # Initialize default debug value to 0. |
| 38 | ${DEBUG} ${0} |
| 39 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | *** Keywords *** |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 41 | |
Sivas SRR | 8254db6 | 2017-02-07 09:39:46 -0600 | [diff] [blame] | 42 | Get BMC System Model |
| 43 | [Documentation] Get the BMC model from the device tree. |
| 44 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 45 | Open Connection And Log In |
George Keishing | 90ab177 | 2017-02-24 05:40:55 -0600 | [diff] [blame] | 46 | ${bmc_model} ${stderr}= Execute Command |
| 47 | ... cat ${devicetree_base} | cut -d " " -f 1 return_stderr=True |
Sivas SRR | 8254db6 | 2017-02-07 09:39:46 -0600 | [diff] [blame] | 48 | Should Be Empty ${stderr} |
| 49 | Should Not Be Empty ${bmc_model} |
| 50 | [Return] ${bmc_model} |
| 51 | |
| 52 | Verify BMC System Model |
| 53 | [Documentation] Verify the BMC model with ${OPENBMC_MODEL}. |
| 54 | [Arguments] ${bmc_model} |
| 55 | |
| 56 | ${tmp_bmc_model}= Fetch From Right ${OPENBMC_MODEL} / |
| 57 | ${tmp_bmc_model}= Fetch From Left ${tmp_bmc_model} . |
| 58 | ${ret}= Run Keyword And Return Status Should Contain ${bmc_model} |
| 59 | ... ${tmp_bmc_model} ignore_case=True |
| 60 | [Return] ${ret} |
| 61 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 62 | Wait For Host To Ping |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 63 | [Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}min |
| 64 | ... ${interval}=5 sec |
| 65 | |
| 66 | # host The DNS name or IP of the host to ping. |
| 67 | # timeout The amount of time after which attempts to ping cease. |
| 68 | # interval The amount of time in between attempts to ping. |
| 69 | |
| 70 | Wait Until Keyword Succeeds ${timeout} ${interval} Ping Host ${host} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 71 | |
| 72 | Ping Host |
| 73 | [Arguments] ${host} |
George Keishing | 8a84f95 | 2016-08-25 04:54:53 -0500 | [diff] [blame] | 74 | Should Not Be Empty ${host} msg=No host provided |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 75 | ${RC} ${output}= Run and return RC and Output ping -c 4 ${host} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 76 | Log RC: ${RC}\nOutput:\n${output} |
| 77 | Should be equal ${RC} ${0} |
| 78 | |
| 79 | Get Boot Progress |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 80 | [Arguments] ${quiet}=${QUIET} |
| 81 | |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 82 | ${state}= Read Attribute ${OPENBMC_BASE_URI}sensors/host/BootProgress |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 83 | ... value quiet=${quiet} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 84 | [Return] ${state} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 85 | |
| 86 | Is Power On |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 87 | ${state}= Get Power State |
| 88 | Should be equal ${state} ${1} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 89 | |
| 90 | Is Power Off |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 91 | ${state}= Get Power State |
| 92 | Should be equal ${state} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 93 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 94 | Initiate Power On |
| 95 | [Documentation] Initiates the power on and waits until the Is Power On |
| 96 | ... keyword returns that the power state has switched to on. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 97 | [Arguments] ${wait}=${1} |
| 98 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 99 | @{arglist}= Create List |
| 100 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 101 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 102 | ... data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 103 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 104 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 105 | # Does caller want to wait for power on status? |
| 106 | Run Keyword If '${wait}' == '${0}' Return From Keyword |
| 107 | Wait Until Keyword Succeeds 3 min 10 sec Is Power On |
Rahul Maheshwari | f684ba7 | 2016-10-25 07:24:41 -0500 | [diff] [blame] | 108 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 109 | Initiate Power Off |
| 110 | [Documentation] Initiates the power off and waits until the Is Power Off |
| 111 | ... keyword returns that the power state has switched to off. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 112 | @{arglist}= Create List |
| 113 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 114 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 115 | ... data=${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 116 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 117 | Wait Until Keyword Succeeds 1 min 10 sec Is Power Off |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 118 | |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 119 | Initiate OS Host Power Off |
| 120 | [Documentation] Initiate an OS reboot. |
| 121 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 122 | ... ${os_password}=${OS_PASSWORD} |
| 123 | |
| 124 | # Description of arguments: |
| 125 | # os_host The DNS name or IP of the OS. |
| 126 | # os_username The username to be used to sign in to the OS. |
| 127 | # os_password The password to be used to sign in to the OS. |
| 128 | |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 129 | SSHLibrary.Open connection ${os_host} |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 130 | Login ${os_username} ${os_password} |
| 131 | ${cmd_buf} Catenate shutdown |
| 132 | Start Command ${cmd_buf} |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 133 | SSHLibrary.Close Connection |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 134 | |
| 135 | Initiate OS Host Reboot |
| 136 | [Documentation] Initiate an OS reboot. |
| 137 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 138 | ... ${os_password}=${OS_PASSWORD} |
| 139 | |
| 140 | # Description of arguments: |
| 141 | # os_host The DNS name or IP of the OS. |
| 142 | # os_username The username to be used to sign in to the OS. |
| 143 | # os_password The password to be used to sign in to the OS. |
| 144 | |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 145 | SSHLibrary.Open connection ${os_host} |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 146 | Login ${os_username} ${os_password} |
| 147 | ${cmd_buf} Catenate reboot |
| 148 | Start Command ${cmd_buf} |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 149 | SSHLibrary.Close Connection |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 150 | |
| 151 | Initiate Auto Reboot |
| 152 | [Documentation] Initiate an auto reboot. |
| 153 | |
| 154 | # Set the auto reboot policy. |
| 155 | Set Auto Reboot yes |
| 156 | |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 157 | SSHLibrary.Open connection ${openbmc_host} |
Michael Walsh | 8184377 | 2017-03-02 14:44:44 -0600 | [diff] [blame] | 158 | Login ${openbmc_username} ${openbmc_password} |
| 159 | |
| 160 | # Set the watchdog timer. Note: 5000 = milliseconds which is 5 seconds. |
| 161 | ${cmd_buf}= Catenate /usr/sbin/mapper call /org/openbmc/watchdog/host0 |
| 162 | ... org.openbmc.Watchdog set i 5000 |
| 163 | ${output} ${stderr} ${rc}= Execute Command ${cmd_buf} |
| 164 | ... return_stderr=True return_rc=True |
| 165 | Should Be Empty ${stderr} |
| 166 | Should be equal ${rc} ${0} |
| 167 | |
| 168 | # Start the watchdog. |
| 169 | ${cmd_buf}= Catenate /usr/sbin/mapper call /org/openbmc/watchdog/host0 |
| 170 | ... org.openbmc.Watchdog start |
| 171 | ${output} ${stderr} ${rc}= Execute Command ${cmd_buf} |
| 172 | ... return_stderr=True return_rc=True |
| 173 | Should Be Empty ${stderr} |
| 174 | Should be equal ${rc} ${0} |
| 175 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 176 | Trigger Warm Reset |
| 177 | log to console "Triggering warm reset" |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 178 | ${data}= create dictionary data=@{EMPTY} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 179 | ${resp}= openbmc post request |
| 180 | ... ${OPENBMC_BASE_URI}control/bmc0/action/warmReset data=${data} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 181 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 182 | ${session_active}= Check If warmReset is Initiated |
| 183 | Run Keyword If '${session_active}' == '${True}' |
| 184 | ... Fail msg=warm reset didn't occur |
| 185 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 186 | Sleep ${SYSTEM_SHUTDOWN_TIME}min |
Rahul Maheshwari | 5f253c4 | 2017-01-30 05:19:51 -0600 | [diff] [blame] | 187 | Check If BMC Is Up |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 188 | |
| 189 | Check OS |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 190 | [Documentation] Attempts to ping the host OS and then checks that the host |
| 191 | ... OS is up by running an SSH command. |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 192 | |
| 193 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 194 | ... ${os_password}=${OS_PASSWORD} ${quiet}=${QUIET} |
| 195 | ... ${print_string}=${EMPTY} |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 196 | [Teardown] SSHLibrary.Close Connection |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 197 | |
| 198 | # os_host The DNS name/IP of the OS host associated with our BMC. |
| 199 | # os_username The username to be used to sign on to the OS host. |
| 200 | # os_password The password to be used to sign on to the OS host. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 201 | # quiet Indicates whether this keyword should write to console. |
| 202 | # print_string A string to be printed before checking the OS. |
| 203 | |
| 204 | rprint ${print_string} |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 205 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 206 | # Attempt to ping the OS. Store the return code to check later. |
| 207 | ${ping_rc}= Run Keyword and Return Status Ping Host ${os_host} |
| 208 | |
Michael Walsh | ac27551 | 2017-03-07 11:39:28 -0600 | [diff] [blame] | 209 | SSHLibrary.Open connection ${os_host} |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 210 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 211 | ${status} ${msg}= Run Keyword And Ignore Error Login ${os_username} |
| 212 | ... ${os_password} |
| 213 | ${err_msg1}= Sprint Error ${msg} |
| 214 | ${err_msg}= Catenate SEPARATOR= \n ${err_msg1} |
| 215 | Run Keyword If '${status}' == 'FAIL' Fail msg=${err_msg} |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 216 | ${output} ${stderr} ${rc}= Execute Command uptime return_stderr=True |
| 217 | ... return_rc=True |
| 218 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 219 | ${temp_msg}= Catenate Could not execute a command on the operating |
| 220 | ... system.\n |
| 221 | ${err_msg1}= Sprint Error ${temp_msg} |
| 222 | ${err_msg}= Catenate SEPARATOR= \n ${err_msg1} |
| 223 | |
| 224 | # If the return code returned by "Execute Command" is non-zero, this |
| 225 | # keyword will fail. |
| 226 | Should Be Equal ${rc} ${0} msg=${err_msg} |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 227 | # We will likewise fail if there is any stderr data. |
| 228 | Should Be Empty ${stderr} |
| 229 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 230 | ${temp_msg}= Set Variable Could not ping the operating system.\n |
| 231 | ${err_msg1}= Sprint Error ${temp_msg} |
| 232 | ${err_msg}= Catenate SEPARATOR= \n ${err_msg1} |
| 233 | # We will likewise fail if the OS did not ping, as we could SSH but not |
| 234 | # ping |
| 235 | Should Be Equal As Strings ${ping_rc} ${TRUE} msg=${err_msg} |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 236 | |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 237 | Wait for OS |
| 238 | [Documentation] Waits for the host OS to come up via calls to "Check OS". |
| 239 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 240 | ... ${os_password}=${OS_PASSWORD} ${timeout}=${OS_WAIT_TIMEOUT} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 241 | ... ${quiet}=${0} |
| 242 | [Teardown] rprintn |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 243 | |
| 244 | # os_host The DNS name or IP of the OS host associated with our |
| 245 | # BMC. |
| 246 | # os_username The username to be used to sign on to the OS host. |
| 247 | # os_password The password to be used to sign on to the OS host. |
| 248 | # timeout The timeout in seconds indicating how long you're |
| 249 | # willing to wait for the OS to respond. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 250 | # quiet Indicates whether this keyword should write to console. |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 251 | |
| 252 | # The interval to be used between calls to "Check OS". |
| 253 | ${interval}= Set Variable 5 |
| 254 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 255 | ${message}= Catenate Checking every ${interval} seconds for up to |
| 256 | ... ${timeout} seconds for the operating system to communicate. |
| 257 | rqprint_timen ${message} |
| 258 | |
Michael Walsh | 49ab0f4 | 2016-07-20 11:44:33 -0500 | [diff] [blame] | 259 | Wait Until Keyword Succeeds ${timeout} sec ${interval} Check OS |
| 260 | ... ${os_host} ${os_username} ${os_password} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 261 | ... print_string=\# |
| 262 | |
| 263 | rqprintn |
| 264 | |
| 265 | rqprint_timen The operating system is now communicating. |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 266 | |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 267 | Get BMC State Deprecated |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 268 | [Documentation] Returns the state of the BMC as a string. (i.e: BMC_READY) |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 269 | [Arguments] ${quiet}=${QUIET} |
| 270 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 271 | @{arglist}= Create List |
| 272 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 273 | ${resp}= Call Method ${OPENBMC_BASE_URI}managers/System/ getSystemState |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 274 | ... data=${args} quiet=${quiet} |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 275 | Should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 276 | ${content}= to json ${resp.content} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 277 | [Return] ${content["data"]} |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 278 | |
| 279 | Get Power State |
| 280 | [Documentation] Returns the power state as an integer. Either 0 or 1. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 281 | [Arguments] ${quiet}=${QUIET} |
| 282 | |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 283 | @{arglist}= Create List |
| 284 | ${args}= Create Dictionary data=@{arglist} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 285 | |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 286 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ getPowerState |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 287 | ... data=${args} quiet=${quiet} |
root | 442f0ef | 2016-08-04 20:23:05 +0000 | [diff] [blame] | 288 | Should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 289 | ${content}= to json ${resp.content} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 290 | [Return] ${content["data"]} |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 291 | |
| 292 | Clear BMC Record Log |
| 293 | [Documentation] Clears all the event logs on the BMC. This would be |
| 294 | ... equivalent to ipmitool sel clear. |
| 295 | @{arglist}= Create List |
| 296 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 297 | ${resp}= Call Method |
| 298 | ... ${OPENBMC_BASE_URI}records/events/ clear data=${args} |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 299 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 300 | |
| 301 | Copy PNOR to BMC |
| 302 | Import Library SCPLibrary WITH NAME scp |
| 303 | Open Connection for SCP |
| 304 | Log Copying ${PNOR_IMAGE_PATH} to /tmp |
| 305 | scp.Put File ${PNOR_IMAGE_PATH} /tmp |
| 306 | |
| 307 | Flash PNOR |
| 308 | [Documentation] Calls flash bios update method to flash PNOR image |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 309 | [Arguments] ${pnor_image} |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 310 | @{arglist}= Create List ${pnor_image} |
| 311 | ${args}= Create Dictionary data=@{arglist} |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 312 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/flash/bios/ update |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 313 | ... data=${args} |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 314 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 315 | Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing |
| 316 | |
| 317 | Get Flash BIOS Status |
| 318 | [Documentation] Returns the status of the flash BIOS API as a string. For |
| 319 | ... example 'Flashing', 'Flash Done', etc |
George Keishing | 85ca05e | 2016-11-30 09:47:18 -0600 | [diff] [blame] | 320 | ${data}= Read Properties ${OPENBMC_BASE_URI}control/flash/bios |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 321 | [Return] ${data['status']} |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 322 | |
| 323 | Is PNOR Flashing |
| 324 | [Documentation] Get BIOS 'Flashing' status. This indicates that PNOR |
| 325 | ... flashing has started. |
| 326 | ${status}= Get Flash BIOS Status |
Rahul Maheshwari | 449dfb7 | 2017-05-08 02:06:48 -0500 | [diff] [blame] | 327 | Should Contain ${status} Flashing |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 328 | |
| 329 | Is PNOR Flash Done |
| 330 | [Documentation] Get BIOS 'Flash Done' status. This indicates that the |
| 331 | ... PNOR flashing has completed. |
Leah McNutt | 9ba3227 | 2016-11-17 15:48:39 +0000 | [diff] [blame] | 332 | ${status}= Get Flash BIOS Status |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 333 | should be equal as strings ${status} Flash Done |
| 334 | |
| 335 | Is System State Host Booted |
| 336 | [Documentation] Checks whether system state is HOST_BOOTED. |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 337 | ${state}= Get BMC State Deprecated |
Jay Azurin | e4c52eb | 2016-08-16 20:51:10 -0500 | [diff] [blame] | 338 | should be equal as strings ${state} HOST_BOOTED |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 339 | |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 340 | Is OS Starting |
| 341 | [Documentation] Check if boot progress is OS starting. |
| 342 | ${boot_progress}= Get Boot Progress |
| 343 | Should Be Equal ${boot_progress} FW Progress, Starting OS |
| 344 | |
George Keishing | 0af2441 | 2017-03-10 13:33:23 -0600 | [diff] [blame] | 345 | Is OS Off |
| 346 | [Documentation] Check if boot progress is "Off". |
| 347 | ${boot_progress}= Get Boot Progress |
| 348 | Should Be Equal ${boot_progress} Off |
| 349 | |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 350 | Verify Ping and REST Authentication |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 351 | ${l_ping}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 352 | ... Ping Host ${OPENBMC_HOST} |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 353 | Run Keyword If '${l_ping}' == '${False}' |
| 354 | ... Fail msg=Ping Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 355 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 356 | ${l_rest}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 357 | ... Initialize OpenBMC |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 358 | Run Keyword If '${l_rest}' == '${False}' |
| 359 | ... Fail msg=REST Authentication Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 360 | |
| 361 | # Just to make sure the SSH is working for SCP |
| 362 | Open Connection And Log In |
| 363 | ${system} ${stderr}= Execute Command hostname return_stderr=True |
| 364 | Should Be Empty ${stderr} |
| 365 | |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 366 | Check If BMC is Up |
| 367 | [Documentation] Wait for Host to be online. Checks every X seconds |
| 368 | ... interval for Y minutes and fails if timed out. |
| 369 | ... Default MAX timedout is 10 min, interval 10 seconds. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 370 | [Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 371 | ... ${interval}=10 sec |
| 372 | |
| 373 | Wait Until Keyword Succeeds |
| 374 | ... ${max_timeout} ${interval} Verify Ping and REST Authentication |
| 375 | |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 376 | |
| 377 | Check If warmReset is Initiated |
| 378 | [Documentation] Ping would be still alive, so try SSH to connect |
| 379 | ... if fails the ports are down indicating reboot |
| 380 | ... is in progress |
George Keishing | 3c05d35 | 2016-12-13 06:54:50 -0600 | [diff] [blame] | 381 | |
| 382 | # Warm reset adds 3 seconds delay before forcing reboot |
| 383 | # To minimize race conditions, we wait for 7 seconds |
| 384 | Sleep 7s |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 385 | ${alive}= Run Keyword and Return Status |
| 386 | ... Open Connection And Log In |
| 387 | Return From Keyword If '${alive}' == '${False}' ${False} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 388 | [Return] ${True} |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 389 | |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 390 | Flush REST Sessions |
| 391 | [Documentation] Removes all the active session objects |
| 392 | Delete All Sessions |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 393 | |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 394 | Initialize DBUS cmd |
| 395 | [Documentation] Initialize dbus string with property string to extract |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 396 | [Arguments] ${boot_property} |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 397 | ${cmd}= Catenate ${dbuscmdBase} ${dbuscmdGet} ${dbuscmdString} |
| 398 | ${cmd}= Catenate ${cmd}${boot_property} |
Sivas SRR | e1143ae | 2016-08-26 22:31:02 -0500 | [diff] [blame] | 399 | Set Global Variable ${dbuscmd} ${cmd} |
| 400 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 401 | Create OS Console File Path |
| 402 | [Documentation] Create OS console file path name and return it. |
| 403 | [Arguments] ${log_file_path}=${EMPTY} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 404 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 405 | # Description of arguements: |
| 406 | # file_path The caller's candidate value. If this value is ${EMPTY}, this |
| 407 | # keyword will compose a file path name. Otherwise, this |
| 408 | # keyword will use the caller's file_path value. In either |
| 409 | # case, the value will be returned. |
Gunnar Mills | 9c76034 | 2016-12-08 10:12:06 -0600 | [diff] [blame] | 410 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 411 | ${default_file_path}= Catenate /tmp/${OPENBMC_HOST}_os_console |
| 412 | ${log_file_path}= Set Variable If '${log_file_path}' == '${EMPTY}' |
| 413 | ... ${default_file_path} ${log_file_path} |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 414 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 415 | [Return] ${log_file_path} |
Gunnar Mills | 9c76034 | 2016-12-08 10:12:06 -0600 | [diff] [blame] | 416 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 417 | Create OS Console Command String |
| 418 | [Documentation] Return a command string to start OS console logging. |
Gunnar Mills | 9c76034 | 2016-12-08 10:12:06 -0600 | [diff] [blame] | 419 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 420 | # First make sure that the ssh_pw program is available. |
| 421 | ${cmd_buf}= Catenate which ssh_pw 2>&1 |
| 422 | Rdpissuing ${cmd_buf} |
| 423 | ${rc} ${output}= Run And Return Rc And Output ${cmd_buf} |
| 424 | Rdpvars rc output |
| 425 | Should Be Equal ${rc} ${0} msg=${output}\n |
Gunnar Mills | 9c76034 | 2016-12-08 10:12:06 -0600 | [diff] [blame] | 426 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 427 | ${cmd_buf}= Catenate ssh_pw ${OPENBMC_PASSWORD} -p 2200 |
| 428 | ... ${OPENBMC_USERNAME}@${OPENBMC_HOST} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 429 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 430 | [Return] ${cmd_buf} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 431 | |
| 432 | Stop SOL Console Logging |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 433 | [Documentation] Stop system console logging and return log output. |
| 434 | [Arguments] ${log_file_path}=${EMPTY} ${targ_file_path}=${EMPTY} |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 435 | ... ${return_data}=${1} |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 436 | |
| 437 | # If there are muliple system console processes, they will all be stopped. |
| 438 | # If there is no existing log file this keyword will return an error |
| 439 | # message to that effect (and write that message to targ_file_path, if |
| 440 | # specified). |
| 441 | # NOTE: This keyword will not fail if there is no running system console |
| 442 | # process. |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 443 | |
| 444 | # Description of arguments: |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 445 | # log_file_path The file path that was used to call "Start SOL |
| 446 | # Console Logging". See that keyword (above) for details. |
| 447 | # targ_file_path If specified, the file path to which the source |
| 448 | # file path (i.e. "log_file_path") should be copied. |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 449 | # return_data If this is set to ${1}, this keyword will return the SOL |
| 450 | # data to the caller as a unicode string. |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 451 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 452 | ${log_file_path}= Create OS Console File Path ${log_file_path} |
| 453 | # Find the pid of the active system console logging session (if any). |
| 454 | ${search_string}= Create OS Console Command String |
| 455 | ${cmd_buf}= Catenate echo $(ps -ef | egrep '${search_string}' |
| 456 | ... | egrep -v grep | cut -c10-14) |
| 457 | Rdpissuing ${cmd_buf} |
| 458 | ${rc} ${os_con_pid}= Run And Return Rc And Output ${cmd_buf} |
| 459 | Rdpvars os_con_pid |
| 460 | # If rc is not zero it just means that there is no OS Console process |
| 461 | # running. |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 462 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 463 | ${cmd_buf}= Catenate kill -9 ${os_con_pid} |
| 464 | Run Keyword If '${os_con_pid}' != '${EMPTY}' Rdpissuing ${cmd_buf} |
| 465 | ${rc} ${output}= Run Keyword If '${os_con_pid}' != '${EMPTY}' |
| 466 | ... Run And Return Rc And Output ${cmd_buf} |
| 467 | Run Keyword If '${os_con_pid}' != '${EMPTY}' Rdpvars rc output |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 468 | |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 469 | Run Keyword If '${targ_file_path}' != '${EMPTY}' |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 470 | ... Run Keyword And Ignore Error |
| 471 | ... Copy File ${log_file_path} ${targ_file_path} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 472 | |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 473 | ${output}= Set Variable ${EMPTY} |
| 474 | ${loc_quiet}= Evaluate ${debug}^1 |
| 475 | ${rc} ${output}= Run Keyword If '${return_data}' == '${1}' |
| 476 | ... Cmd Fnc cat ${log_file_path} quiet=${loc_quiet} print_output=${0} |
| 477 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 478 | [Return] ${output} |
| 479 | |
| 480 | Start SOL Console Logging |
| 481 | [Documentation] Start system console log to file. |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 482 | [Arguments] ${log_file_path}=${EMPTY} ${return_data}=${1} |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 483 | |
| 484 | # This keyword will first call "Stop SOL Console Logging". Only then will |
| 485 | # it start SOL console logging. The data returned by "Stop SOL Console |
| 486 | # Logging" will in turn be returned by this keyword. |
| 487 | |
| 488 | # Description of arguments: |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 489 | # log_file_path The file path to which system console log data should be |
| 490 | # written. Note that this path is taken to be a location |
| 491 | # on the machine where this program is running rather than |
| 492 | # on the Open BMC system. |
| 493 | # return_data If this is set to ${1}, this keyword will return any SOL |
| 494 | # data to the caller as a unicode string. |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 495 | |
| 496 | ${log_file_path}= Create OS Console File Path ${log_file_path} |
| 497 | |
| 498 | ${log_output}= Stop SOL Console Logging ${log_file_path} |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 499 | ... return_data=${return_data} |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 500 | |
| 501 | # Validate by making sure we can create the file. Problems creating the |
| 502 | # file would not be noticed by the subsequent ssh command because we fork |
| 503 | # the command. |
| 504 | Create File ${log_file_path} |
| 505 | ${sub_cmd_buf}= Create OS Console Command String |
| 506 | # Routing stderr to stdout so that any startup error text will go to the |
| 507 | # output file. |
| 508 | ${cmd_buf}= Catenate ${sub_cmd_buf} > ${log_file_path} 2>&1 & |
| 509 | Rdpissuing ${cmd_buf} |
| 510 | ${rc} ${output}= Run And Return Rc And Output ${cmd_buf} |
| 511 | # Because we are forking this command, we essentially will never get a |
| 512 | # non-zero return code or any output. |
| 513 | Should Be Equal ${rc} ${0} |
| 514 | |
| 515 | [Return] ${log_output} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 516 | |
| 517 | Get Time Stamp |
| 518 | [Documentation] Get the current time stamp data |
| 519 | ${cur_time}= Get Current Date result_format=%Y%m%d%H%M%S%f |
Sridevi Ramesh | b96a0c3 | 2016-10-19 05:09:52 -0500 | [diff] [blame] | 520 | [Return] ${cur_time} |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 521 | |
George Keishing | 1b15020 | 2016-09-29 08:51:58 -0500 | [diff] [blame] | 522 | |
| 523 | Verify BMC State |
| 524 | [Documentation] Get the BMC state and verify if the current |
| 525 | ... BMC state is as expected. |
| 526 | [Arguments] ${expected} |
| 527 | |
Rahul Maheshwari | 2c72504 | 2017-01-29 22:55:28 -0600 | [diff] [blame] | 528 | ${current}= Get BMC State Deprecated |
George Keishing | 8db0e1b | 2016-10-20 13:46:54 -0500 | [diff] [blame] | 529 | Should Contain ${expected} ${current} |
George Keishing | 1b15020 | 2016-09-29 08:51:58 -0500 | [diff] [blame] | 530 | |
Rahul Maheshwari | f684ba7 | 2016-10-25 07:24:41 -0500 | [diff] [blame] | 531 | Start Journal Log |
| 532 | [Documentation] Start capturing journal log to a file in /tmp using |
| 533 | ... journalctl command. By default journal log is collected |
| 534 | ... at /tmp/journal_log else user input location. |
| 535 | ... The File is appended with datetime. |
| 536 | [Arguments] ${file_path}=/tmp/journal_log |
| 537 | |
| 538 | Open Connection And Log In |
| 539 | |
| 540 | ${cur_time}= Get Time Stamp |
| 541 | Set Global Variable ${LOG_TIME} ${cur_time} |
| 542 | Start Command |
| 543 | ... journalctl -f > ${file_path}-${LOG_TIME} |
| 544 | Log Journal Log Started: ${file_path}-${LOG_TIME} |
| 545 | |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 546 | |
Rahul Maheshwari | f684ba7 | 2016-10-25 07:24:41 -0500 | [diff] [blame] | 547 | Stop Journal Log |
| 548 | [Documentation] Stop journalctl process if its running. |
| 549 | ... By default return log from /tmp/journal_log else |
| 550 | ... user input location. |
| 551 | [Arguments] ${file_path}=/tmp/journal_log |
| 552 | |
| 553 | Open Connection And Log In |
| 554 | |
| 555 | ${rc}= |
| 556 | ... Execute Command |
| 557 | ... ps ax | grep journalctl | grep -v grep |
| 558 | ... return_stdout=False return_rc=True |
| 559 | |
| 560 | Return From Keyword If '${rc}' == '${1}' |
| 561 | ... No journal log process running |
| 562 | |
| 563 | ${output} ${stderr}= |
| 564 | ... Execute Command killall journalctl |
| 565 | ... return_stderr=True |
| 566 | Should Be Empty ${stderr} |
| 567 | |
| 568 | ${journal_log} ${stderr}= |
| 569 | ... Execute Command |
| 570 | ... cat ${file_path}-${LOG_TIME} |
| 571 | ... return_stderr=True |
| 572 | Should Be Empty ${stderr} |
| 573 | |
| 574 | Log ${journal_log} |
| 575 | |
| 576 | Execute Command rm ${file_path}-${LOG_TIME} |
| 577 | |
| 578 | [Return] ${journal_log} |
Rahul Maheshwari | 757d80c | 2016-10-17 01:09:55 -0500 | [diff] [blame] | 579 | |
| 580 | Mac Address To Hex String |
| 581 | [Documentation] Converts MAC address into hex format. |
| 582 | ... Example |
| 583 | ... Given the following MAC: 00:01:6C:80:02:78 |
| 584 | ... This keyword will return: 0x00 0x01 0x6C 0x80 0x02 0x78 |
| 585 | ... Description of arguments: |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 586 | ... i_macaddress MAC address in the following format |
| 587 | ... 00:01:6C:80:02:78 |
Rahul Maheshwari | 757d80c | 2016-10-17 01:09:55 -0500 | [diff] [blame] | 588 | [Arguments] ${i_macaddress} |
| 589 | |
| 590 | ${mac_hex}= Catenate 0x${i_macaddress.replace(':', ' 0x')} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 591 | [Return] ${mac_hex} |
Rahul Maheshwari | 757d80c | 2016-10-17 01:09:55 -0500 | [diff] [blame] | 592 | |
| 593 | IP Address To Hex String |
| 594 | [Documentation] Converts IP address into hex format. |
| 595 | ... Example: |
| 596 | ... Given the following IP: 10.3.164.100 |
| 597 | ... This keyword will return: 0xa 0x3 0xa4 0xa0 |
| 598 | ... Description of arguments: |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 599 | ... i_ipaddress IP address in the following format |
| 600 | ... 10.10.10.10 |
Rahul Maheshwari | 757d80c | 2016-10-17 01:09:55 -0500 | [diff] [blame] | 601 | [Arguments] ${i_ipaddress} |
| 602 | |
| 603 | @{ip}= Split String ${i_ipaddress} . |
| 604 | ${index}= Set Variable ${0} |
| 605 | |
| 606 | :FOR ${item} IN @{ip} |
| 607 | \ ${hex}= Convert To Hex ${item} prefix=0x lowercase=yes |
| 608 | \ Set List Value ${ip} ${index} ${hex} |
| 609 | \ ${index}= Set Variable ${index + 1} |
| 610 | ${ip_hex}= Catenate @{ip} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 611 | [Return] ${ip_hex} |
Sivas SRR | ea85d1f | 2016-11-13 22:44:28 -0600 | [diff] [blame] | 612 | |
| 613 | BMC CPU Performance Check |
| 614 | [Documentation] Minimal 10% of proc should be free in this instance |
| 615 | |
| 616 | ${bmc_cpu_usage_output} ${stderr}= Execute Command ${bmc_cpu_usage_cmd} |
| 617 | ... return_stderr=True |
| 618 | Should be empty ${stderr} |
| 619 | ${bmc_cpu_percentage}= Fetch From Left ${bmc_cpu_usage_output} % |
| 620 | Should be true ${bmc_cpu_percentage} < 90 |
| 621 | |
| 622 | BMC Mem Performance Check |
| 623 | [Documentation] Minimal 10% of memory should be free in this instance |
| 624 | |
| 625 | ${bmc_mem_free_output} ${stderr}= Execute Command ${bmc_mem_free_cmd} |
| 626 | ... return_stderr=True |
| 627 | Should be empty ${stderr} |
| 628 | |
| 629 | ${bmc_mem_total_output} ${stderr}= Execute Command ${bmc_mem_total_cmd} |
| 630 | ... return_stderr=True |
| 631 | Should be empty ${stderr} |
| 632 | |
| 633 | ${bmc_mem_percentage}= Evaluate ${bmc_mem_free_output}*100 |
| 634 | ${bmc_mem_percentage}= Evaluate |
| 635 | ... ${bmc_mem_percentage}/${bmc_mem_total_output} |
| 636 | Should be true ${bmc_mem_percentage} > 10 |
| 637 | |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 638 | BMC File System Usage Check |
| 639 | [Documentation] Check the file system space. None should be 100% full |
Sivas SRR | 352bc16 | 2017-02-13 22:12:29 -0600 | [diff] [blame] | 640 | ... except /run/initramfs/ro |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 641 | ${bmc_fs_usage_output} ${stderr}= Execute Command |
| 642 | ... ${bmc_file_system_usage_cmd} return_stderr=True |
| 643 | Should Be Empty ${stderr} |
| 644 | Should Be True ${bmc_fs_usage_output}==0 |
| 645 | |
Sivas SRR | ea85d1f | 2016-11-13 22:44:28 -0600 | [diff] [blame] | 646 | Check BMC CPU Performance |
| 647 | [Documentation] Minimal 10% of proc should be free in 3 sample |
| 648 | :FOR ${var} IN Range 1 4 |
| 649 | \ BMC CPU Performance check |
| 650 | |
| 651 | Check BMC Mem Performance |
| 652 | [Documentation] Minimal 10% of memory should be free |
| 653 | |
| 654 | :FOR ${var} IN Range 1 4 |
| 655 | \ BMC Mem Performance check |
| 656 | |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 657 | Check BMC File System Performance |
| 658 | [Documentation] Check for file system usage for 4 times |
| 659 | |
| 660 | :FOR ${var} IN Range 1 4 |
| 661 | \ BMC File System Usage check |
| 662 | |
Rahul Maheshwari | 63c105b | 2017-05-12 05:13:52 -0500 | [diff] [blame] | 663 | Get URL List |
| 664 | [Documentation] Return list of URLs under given URL. |
| 665 | [Arguments] ${openbmc_url} |
| 666 | # Description of argument(s): |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 667 | # openbmc_url URL for list operation (e.g. |
| 668 | # /xyz/openbmc_project/inventory). |
Rahul Maheshwari | 63c105b | 2017-05-12 05:13:52 -0500 | [diff] [blame] | 669 | |
| 670 | ${url_list}= Read Properties ${openbmc_url}/list |
| 671 | [Return] ${url_list} |
| 672 | |
Rahul Maheshwari | 9a8d3b1 | 2016-12-05 04:06:16 -0600 | [diff] [blame] | 673 | Get Endpoint Paths |
| 674 | [Documentation] Returns all url paths ending with given endpoint |
| 675 | ... Example: |
| 676 | ... Given the following endpoint: cpu |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 677 | ... This keyword will return: list of all urls ending with |
| 678 | ... cpu - |
Rahul Maheshwari | 9a8d3b1 | 2016-12-05 04:06:16 -0600 | [diff] [blame] | 679 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu0, |
| 680 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu1 |
| 681 | ... Description of arguments: |
| 682 | ... path URL path for enumeration |
| 683 | ... endpoint string for which url path ending |
| 684 | [Arguments] ${path} ${endpoint} |
| 685 | |
| 686 | ${resp}= Read Properties ${path}/enumerate timeout=30 |
| 687 | log Dictionary ${resp} |
| 688 | |
| 689 | ${list}= Get Dictionary Keys ${resp} |
| 690 | ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}[0-9]*$ |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 691 | [Return] ${resp} |
Sridevi Ramesh | b96a0c3 | 2016-10-19 05:09:52 -0500 | [diff] [blame] | 692 | |
| 693 | Check Zombie Process |
| 694 | [Documentation] Check if any defunct process exist or not on BMC |
Michael Walsh | 01bd368 | 2017-01-10 11:21:05 -0600 | [diff] [blame] | 695 | ${count} ${stderr} ${rc}= Execute Command ps -o stat | grep Z | wc -l |
Sridevi Ramesh | b96a0c3 | 2016-10-19 05:09:52 -0500 | [diff] [blame] | 696 | ... return_stderr=True return_rc=True |
| 697 | Should Be True ${count}==0 |
| 698 | Should Be Empty ${stderr} |
George Keishing | 5327d01 | 2016-12-08 08:43:29 -0600 | [diff] [blame] | 699 | |
| 700 | Prune Journal Log |
| 701 | [Documentation] Prune archived journal logs. |
| 702 | [Arguments] ${vacuum_size}=1M |
| 703 | |
| 704 | # This keyword can be used to prevent the journal |
| 705 | # log from filling up the /run filesystem. |
| 706 | # This command will retain only the latest logs |
| 707 | # of the user specified size. |
| 708 | |
| 709 | Open Connection And Log In |
| 710 | ${output} ${stderr} ${rc}= |
| 711 | ... Execute Command |
| 712 | ... journalctl --vacuum-size=${vacuum_size} |
| 713 | ... return_stderr=True return_rc=True |
| 714 | |
| 715 | Should Be Equal ${rc} ${0} msg=${stderr} |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 716 | |
| 717 | Set BMC Power Policy |
| 718 | [Documentation] Set the given BMC power policy. |
| 719 | [arguments] ${policy} |
| 720 | |
| 721 | ${valueDict}= create dictionary data=${policy} |
| 722 | Write Attribute ${HOST_SETTING} power_policy data=${valueDict} |
| 723 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 724 | Should Be Equal ${currentPolicy} ${policy} |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 725 | |
George Keishing | 4d6f3d6 | 2017-02-06 09:50:41 -0600 | [diff] [blame] | 726 | Get System Power Policy |
| 727 | [Documentation] Get the BMC power policy. |
| 728 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 729 | [Return] ${currentPolicy} |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 730 | |
Rahul Maheshwari | 1cbf004 | 2017-02-13 05:17:37 -0600 | [diff] [blame] | 731 | Get Auto Reboot |
| 732 | [Documentation] Returns auto reboot setting. |
Sridevi Ramesh | 4dbe659 | 2017-04-06 01:47:52 -0500 | [diff] [blame] | 733 | ${setting}= Read Attribute ${HOST_SETTING} auto_reboot |
Rahul Maheshwari | 1cbf004 | 2017-02-13 05:17:37 -0600 | [diff] [blame] | 734 | [Return] ${setting} |
| 735 | |
| 736 | |
| 737 | Set Auto Reboot |
| 738 | [Documentation] Set the given auto reboot setting. |
| 739 | [Arguments] ${setting} |
| 740 | # setting auto reboot's setting, i.e. yes or no |
| 741 | |
| 742 | ${valueDict}= Set Variable ${setting} |
| 743 | ${data}= Create Dictionary data=${valueDict} |
Sridevi Ramesh | 4dbe659 | 2017-04-06 01:47:52 -0500 | [diff] [blame] | 744 | Write Attribute ${HOST_SETTING} auto_reboot data=${data} |
Rahul Maheshwari | 1cbf004 | 2017-02-13 05:17:37 -0600 | [diff] [blame] | 745 | ${current_setting}= Get Auto Reboot |
| 746 | Should Be Equal ${current_setting} ${setting} |
| 747 | |
| 748 | |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 749 | Set BMC Reset Reference Time |
| 750 | [Documentation] Set current boot time as a reference and increment |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 751 | ... boot count. |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 752 | |
| 753 | ${cur_btime}= Get BMC Boot Time |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 754 | Run Keyword If ${BOOT_TIME} == ${0} and ${BOOT_COUNT} == ${0} |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 755 | ... Set Global Variable ${BOOT_TIME} ${cur_btime} |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 756 | ... ELSE IF ${cur_btime} > ${BOOT_TIME} |
| 757 | ... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime} |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 758 | ... AND |
| 759 | ... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1} |
| 760 | |
George Keishing | cce9df2 | 2017-01-24 06:19:33 -0600 | [diff] [blame] | 761 | Get BMC Boot Time |
| 762 | [Documentation] Get boot time from /proc/stat. |
| 763 | |
| 764 | Open Connection And Log In |
| 765 | ${output} ${stderr}= |
| 766 | ... Execute Command egrep '^btime ' /proc/stat | cut -f 2 -d ' ' |
| 767 | ... return_stderr=True |
| 768 | Should Be Empty ${stderr} |
| 769 | ${btime}= Convert To Integer ${output} |
| 770 | [Return] ${btime} |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 771 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 772 | Execute Command On BMC |
| 773 | [Documentation] Execute given command on BMC and return output. |
| 774 | [Arguments] ${command} |
| 775 | ${stdout} ${stderr}= Execute Command ${command} return_stderr=True |
| 776 | Should Be Empty ${stderr} |
| 777 | [Return] ${stdout} |
David Shaw | ba2d2c2 | 2017-01-23 16:56:38 -0600 | [diff] [blame] | 778 | |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 779 | |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 780 | Enable Core Dump On BMC |
| 781 | [Documentation] Enable core dump collection. |
| 782 | Open Connection And Log In |
| 783 | ${core_pattern}= Execute Command On BMC |
| 784 | ... echo '/tmp/core_%e.%p' | tee /proc/sys/kernel/core_pattern |
| 785 | Should Be Equal As Strings ${core_pattern} /tmp/core_%e.%p |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 786 | |
Sivas SRR | 01262bd | 2017-03-19 10:00:23 -0500 | [diff] [blame] | 787 | Get Number Of BMC Core Dump Files |
| 788 | [Documentation] Get number of core dump files on BMC. |
| 789 | Open Connection And Log In |
| 790 | ${num_of_core_dump}= Execute Command |
| 791 | ... ls /tmp/core* 2>/dev/null | wc -l |
| 792 | [Return] ${num_of_core_dump} |
| 793 | |
| 794 | Set Core Dump File Size Unlimited |
| 795 | [Documentation] Set core dump file size to unlimited. |
| 796 | Open Connection And Log In |
| 797 | Execute Command On BMC |
| 798 | ... ulimit -c unlimited |
| 799 | |
| 800 | Check For Core Dumps |
| 801 | [Documentation] Check for any core dumps exist. |
| 802 | ${output}= Get Number Of BMC Core Dump Files |
| 803 | Run Keyword If ${output} > 0 |
| 804 | ... Log **Warning** BMC core dump files exist level=WARN |
| 805 | |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 806 | Trigger Host Watchdog Error |
| 807 | [Documentation] Inject host watchdog error using BMC. |
| 808 | [Arguments] ${milliseconds}=1000 ${sleep_time}=5s |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 809 | # Description of argument(s): |
| 810 | # milliseconds The time watchdog timer value in milliseconds (e.g. 1000 = |
| 811 | # 1 second). |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 812 | # sleep_time Time delay for host watchdog error to get injected. |
| 813 | # Default is 5 seconds. |
| 814 | |
| 815 | Execute Command On BMC |
| 816 | ... /usr/sbin/mapper call /org/openbmc/watchdog/host0 org.openbmc.Watchdog set i ${milliseconds} |
| 817 | Execute Command On BMC |
| 818 | ... /usr/sbin/mapper call /org/openbmc/watchdog/host0 org.openbmc.Watchdog start |
| 819 | Sleep ${sleep_time} |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 820 | |
| 821 | Login To OS Host |
| 822 | [Documentation] Login to OS Host. |
| 823 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 824 | ... ${os_password}=${OS_PASSWORD} |
| 825 | # Desription of arguments: |
| 826 | # ${os_host} IP address of the OS Host. |
| 827 | # ${os_username} OS Host Login user name. |
| 828 | # ${os_password} OS Host Login passwrd. |
| 829 | |
| 830 | ${os_state}= Run Keyword And Return Status Ping Host ${os_host} |
| 831 | Run Keyword If '${os_state}' == 'False' |
| 832 | ... Run Keywords Initiate Host Reboot AND |
| 833 | ... Is Host Running AND |
| 834 | ... Wait for OS ${os_host} ${os_username} ${os_password} |
| 835 | |
| 836 | Open Connection ${os_host} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 837 | ${resp}= Login ${os_username} ${os_password} |
| 838 | [Return] ${resp} |
Prashanth Katti | 884ee06 | 2017-03-16 05:05:03 -0500 | [diff] [blame] | 839 | |
| 840 | Configure Initial Settings |
| 841 | [Documentation] Restore old IP and route. |
| 842 | ... This keyword requires initial settings viz IP address, |
| 843 | ... Network Mask, default gatway and serial console IP and port |
| 844 | ... information which should be provided in command line. |
| 845 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 846 | [Arguments] ${host}=${OPENBMC_HOST} ${mask}=${NET_MASK} |
| 847 | ... ${gw_ip}=${GW_IP} |
Prashanth Katti | 884ee06 | 2017-03-16 05:05:03 -0500 | [diff] [blame] | 848 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 849 | # Open telnet connection and ignore the error, in case telnet session is |
| 850 | # already opened by the program calling this keyword. |
Prashanth Katti | 884ee06 | 2017-03-16 05:05:03 -0500 | [diff] [blame] | 851 | |
| 852 | Run Keyword And Ignore Error Open Telnet Connection to BMC Serial Console |
| 853 | Telnet.write ifconfig eth0 ${host} netmask ${mask} |
| 854 | Telnet.write route add default gw ${gw_ip} |
George Keishing | d05b108 | 2017-03-24 05:27:32 -0500 | [diff] [blame] | 855 | |
| 856 | Install Debug Tarball On BMC |
George Keishing | 5544182 | 2017-05-18 14:17:59 -0500 | [diff] [blame] | 857 | [Documentation] Copy the debug tar file to BMC and install. |
| 858 | [Arguments] ${tarball_file_path}=${EXECDIR}/obmc-phosphor-debug-tarball-witherspoon.tar.xz |
| 859 | ... ${targ_tarball_dir_path}=/home/root/tarball/ |
George Keishing | d05b108 | 2017-03-24 05:27:32 -0500 | [diff] [blame] | 860 | |
George Keishing | 5544182 | 2017-05-18 14:17:59 -0500 | [diff] [blame] | 861 | # Description of arguments: |
| 862 | # tarball_file_path Path of the debug tarball file. |
| 863 | # The tar file is downloaded from the build page |
| 864 | # https://openpower.xyz/job/openbmc-build/ |
| 865 | # obmc-phosphor-debug-tarball-witherspoon.tar.xz |
| 866 | # |
| 867 | # targ_tarball_dir_path The directory path where the tarball is to be |
| 868 | # installed. |
| 869 | |
| 870 | OperatingSystem.File Should Exist ${tarball_file_path} |
| 871 | ... msg=${tarball_file_path} doesn't exist. |
| 872 | |
| 873 | # Upload the file to BMC. |
George Keishing | d05b108 | 2017-03-24 05:27:32 -0500 | [diff] [blame] | 874 | Import Library SCPLibrary WITH NAME scp |
| 875 | Open Connection for SCP |
George Keishing | 5544182 | 2017-05-18 14:17:59 -0500 | [diff] [blame] | 876 | scp.Put File ${tarball_file_path} /tmp/debug-tarball.tar.xz |
| 877 | |
| 878 | # Create tarball directory and install. |
George Keishing | d05b108 | 2017-03-24 05:27:32 -0500 | [diff] [blame] | 879 | Open Connection And Log In |
George Keishing | 5544182 | 2017-05-18 14:17:59 -0500 | [diff] [blame] | 880 | Execute Command On BMC mkdir -p ${targ_tarball_dir_path} |
| 881 | Execute Command On BMC |
| 882 | ... tar -xf /tmp/debug-tarball.tar.xz -C ${targ_tarball_dir_path} |
| 883 | |
| 884 | # Create symlink to callout-test binary. |
| 885 | Execute Command On BMC |
| 886 | ... ln -s ${targ_tarball_dir_path}/bin/callout-test /usr/bin/callout-test |
| 887 | |
George Keishing | d05b108 | 2017-03-24 05:27:32 -0500 | [diff] [blame] | 888 | # Remove the tarball file from BMC |
| 889 | Execute Command On BMC rm /tmp/debug-tarball.tar.xz |
| 890 | |
George Keishing | 5544182 | 2017-05-18 14:17:59 -0500 | [diff] [blame] | 891 | |
Sweta Potthuri | 025e012 | 2017-02-21 00:42:48 -0600 | [diff] [blame] | 892 | Get BMC Boot Count |
| 893 | [Documentation] Get BMC boot count based on boot time. |
| 894 | ${cur_btime}= Get BMC Boot Time |
| 895 | |
| 896 | # Set global variable BOOT_TIME to current boot time if current boot time |
| 897 | # is changed. Also increase value of global variable BOOT_COUNT by 1. |
| 898 | Run Keyword If ${cur_btime} > ${BOOT_TIME} |
| 899 | ... Run Keywords Set Global Variable ${BOOT_TIME} ${cur_btime} |
| 900 | ... AND |
| 901 | ... Set Global Variable ${BOOT_COUNT} ${BOOT_COUNT + 1} |
| 902 | [Return] ${BOOT_COUNT} |
| 903 | |
| 904 | Set BMC Boot Count |
| 905 | [Documentation] Set BMC boot count to given value. |
| 906 | [Arguments] ${count} |
| 907 | |
| 908 | # Description of arguments: |
| 909 | # count boot count value. |
| 910 | ${cur_btime}= Get BMC Boot Time |
| 911 | |
| 912 | # Set global variable BOOT_COUNT to given value. |
| 913 | Set Global Variable ${BOOT_COUNT} ${count} |
| 914 | |
| 915 | # Set BOOT_TIME variable to current boot time. |
| 916 | Set Global Variable ${BOOT_COUNT} ${count} |
Michael Walsh | 689fbbe | 2017-04-04 17:58:03 -0500 | [diff] [blame] | 917 | |
| 918 | ############################################################################### |
| 919 | Delete Error logs |
| 920 | [Documentation] Delete error logs. |
| 921 | |
| 922 | # The REST method to delete error openbmc/openbmc#1327 |
| 923 | # until then using logging restart. |
| 924 | Open Connection And Log In |
| 925 | Execute Command On BMC |
| 926 | ... systemctl restart xyz.openbmc_project.Logging.service |
| 927 | Sleep 10s reason=Wait for logging service to restart properly. |
George Keishing | db34c2f | 2017-04-18 13:20:25 -0500 | [diff] [blame] | 928 | |
| 929 | ############################################################################### |
| 930 | Delete Error log Entry |
| 931 | [Documentation] Delete error log entry. |
| 932 | [Arguments] ${entry_path} |
| 933 | |
| 934 | # Description of argument(s): |
| 935 | # entry_path Delete an error log entry. |
| 936 | # Ex. /xyz/openbmc_project/logging/entry/1 |
| 937 | |
| 938 | ${data}= Create Dictionary data=@{EMPTY} |
| 939 | ${resp}= Openbmc Delete Request ${entry_path} data=${data} |
| 940 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |