Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 2 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 3 | Documentation Utilities for Robot keywords that use REST. |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 4 | |
Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 5 | Resource ../lib/resource.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 6 | Resource ../lib/rest_client.robot |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 7 | Resource ../lib/connection_client.robot |
Rahul Maheshwari | d1f45f2 | 2018-10-26 05:16:39 -0500 | [diff] [blame] | 8 | Resource ../lib/boot_utils.robot |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 9 | Resource ../lib/common_utils.robot |
George Keishing | c070110 | 2021-09-30 12:12:04 -0500 | [diff] [blame] | 10 | Resource ../lib/bmc_redfish_utils.robot |
George Keishing | 9a28860 | 2021-12-10 04:50:25 -0600 | [diff] [blame] | 11 | Resource ../lib/ipmi_client.robot |
Michael Walsh | 391ba9b | 2017-08-24 11:36:24 -0500 | [diff] [blame] | 12 | Library String |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 13 | Library DateTime |
| 14 | Library Process |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | Library OperatingSystem |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 16 | Library gen_print.py |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 17 | Library gen_misc.py |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 18 | Library gen_robot_print.py |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 19 | Library gen_cmd.py |
Sunil M | acd110a | 2017-05-23 04:14:32 -0500 | [diff] [blame] | 20 | Library gen_robot_keyword.py |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 21 | Library bmc_ssh_utils.py |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 22 | Library utils.py |
Charles Paul Hofer | 3581615 | 2017-10-02 11:55:11 -0500 | [diff] [blame] | 23 | Library var_funcs.py |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 24 | Library SCPLibrary WITH NAME scp |
George Keishing | 61364e5 | 2019-10-01 12:01:19 -0500 | [diff] [blame] | 25 | Library gen_robot_valid.py |
George Keishing | 83c737b | 2022-05-17 12:12:04 -0500 | [diff] [blame] | 26 | Library pldm_utils.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 28 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 29 | *** Variables *** |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 30 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 31 | ${SYSTEM_SHUTDOWN_TIME} ${5} |
| 32 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 33 | # Assign default value to QUIET for programs which may not define it. |
| 34 | ${QUIET} ${0} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 35 | |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 36 | ${HOST_SETTING} ${SETTINGS_URI}host0 |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 37 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 38 | ${boot_prog_method} ${EMPTY} |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 39 | ${power_policy_setup} ${0} |
| 40 | ${bmc_power_policy_method} ${EMPTY} |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 41 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 42 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 43 | *** Keywords *** |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 44 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 45 | |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 46 | Verify Ping and REST Authentication |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 47 | [Documentation] Verify ping and rest authentication. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 48 | ${l_ping}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 49 | ... Ping Host ${OPENBMC_HOST} |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 50 | Run Keyword If '${l_ping}' == '${False}' |
| 51 | ... Fail msg=Ping Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 52 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 53 | ${l_rest}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 54 | ... Initialize OpenBMC |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 55 | Run Keyword If '${l_rest}' == '${False}' |
| 56 | ... Fail msg=REST Authentication Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 57 | |
| 58 | # Just to make sure the SSH is working for SCP |
| 59 | Open Connection And Log In |
| 60 | ${system} ${stderr}= Execute Command hostname return_stderr=True |
| 61 | Should Be Empty ${stderr} |
| 62 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 63 | |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 64 | Verify Ping SSH And Redfish Authentication |
| 65 | [Documentation] Verify ping, SSH and redfish authentication. |
| 66 | |
| 67 | ${l_ping}= Run Keyword And Return Status Ping Host ${OPENBMC_HOST} |
| 68 | Run Keyword If '${l_ping}' == '${False}' Fail msg=Ping Failed |
| 69 | |
| 70 | ${l_rest}= Run Keyword And Return Status Redfish.Login |
| 71 | Run Keyword If '${l_rest}' == '${False}' Fail msg=REST Authentication Failed |
| 72 | |
| 73 | # Just to make sure the SSH is working. |
| 74 | Open Connection And Log In |
| 75 | ${system} ${stderr}= Execute Command hostname return_stderr=True |
| 76 | Should Be Empty ${stderr} |
| 77 | |
| 78 | |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 79 | Check If BMC is Up |
| 80 | [Documentation] Wait for Host to be online. Checks every X seconds |
| 81 | ... interval for Y minutes and fails if timed out. |
| 82 | ... Default MAX timedout is 10 min, interval 10 seconds. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 83 | [Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 84 | ... ${interval}=10 sec |
| 85 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 86 | # Description of argument(s): |
| 87 | # max_timeout Maximum time to wait. |
| 88 | # This should be expressed in Robot Framework's time format |
| 89 | # (e.g. "10 minutes"). |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 90 | # interval Interval to wait between status checks. |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 91 | # This should be expressed in Robot Framework's time format |
| 92 | # (e.g. "5 seconds"). |
| 93 | |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 94 | Wait Until Keyword Succeeds |
| 95 | ... ${max_timeout} ${interval} Verify Ping and REST Authentication |
| 96 | |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 97 | |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 98 | Flush REST Sessions |
| 99 | [Documentation] Removes all the active session objects |
| 100 | Delete All Sessions |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 101 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 102 | |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 103 | Trigger Host Watchdog Error |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 104 | [Documentation] Inject host watchdog timeout error via REST. |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 105 | [Arguments] ${milliseconds}=1000 ${sleep_time}=5s |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 106 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 107 | # Description of argument(s): |
| 108 | # milliseconds The time watchdog timer value in milliseconds (e.g. 1000 = |
| 109 | # 1 second). |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 110 | # sleep_time Time delay for host watchdog error to get injected. |
| 111 | # Default is 5 seconds. |
| 112 | |
Michael Walsh | 4ffd1a1 | 2018-03-14 10:35:44 -0500 | [diff] [blame] | 113 | ${data}= Create Dictionary |
| 114 | ... data=xyz.openbmc_project.State.Watchdog.Action.PowerCycle |
| 115 | ${status} ${result}= Run Keyword And Ignore Error |
| 116 | ... Read Attribute ${HOST_WATCHDOG_URI} ExpireAction |
| 117 | Run Keyword If '${status}' == 'PASS' |
| 118 | ... Write Attribute ${HOST_WATCHDOG_URI} ExpireAction data=${data} |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 119 | |
Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 120 | ${int_milliseconds}= Convert To Integer ${milliseconds} |
| 121 | ${data}= Create Dictionary data=${int_milliseconds} |
Michael Walsh | 4ffd1a1 | 2018-03-14 10:35:44 -0500 | [diff] [blame] | 122 | Write Attribute ${HOST_WATCHDOG_URI} Interval data=${data} |
| 123 | |
| 124 | ${data}= Create Dictionary data=${True} |
| 125 | Write Attribute ${HOST_WATCHDOG_URI} Enabled data=${data} |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 126 | |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 127 | Sleep ${sleep_time} |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 128 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 129 | |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 130 | Login To OS Host |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 131 | [Documentation] Login to OS Host and return the Login response code. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 132 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 133 | ... ${os_password}=${OS_PASSWORD} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 134 | |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 135 | # Description of arguments: |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 136 | # ${os_host} IP address of the OS Host. |
| 137 | # ${os_username} OS Host Login user name. |
| 138 | # ${os_password} OS Host Login passwrd. |
| 139 | |
George Keishing | 1856d33 | 2021-11-15 08:38:53 -0600 | [diff] [blame] | 140 | Redfish Power On stack_mode=skip quiet=1 |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 141 | |
George Keishing | 3f223b8 | 2017-06-28 03:50:35 -0500 | [diff] [blame] | 142 | SSHLibrary.Open Connection ${os_host} |
George Keishing | e003088 | 2019-02-21 03:48:27 -0600 | [diff] [blame] | 143 | ${resp}= SSHLibrary.Login ${os_username} ${os_password} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 144 | [Return] ${resp} |
Prashanth Katti | 884ee06 | 2017-03-16 05:05:03 -0500 | [diff] [blame] | 145 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 146 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 147 | Initiate Auto Reboot |
| 148 | [Documentation] Initiate an auto reboot. |
| 149 | [Arguments] ${milliseconds}=5000 |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 150 | |
| 151 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 152 | # milliseconds The number of milliseconds for the watchdog timer. |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 153 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 154 | # Set the auto reboot policy. |
| 155 | Set Auto Reboot ${1} |
| 156 | # Set the watchdog timer. |
| 157 | Trigger Host Watchdog Error ${milliseconds} |
| 158 | |
| 159 | |
| 160 | Initiate OS Host Reboot |
| 161 | [Documentation] Initiate an OS reboot. |
| 162 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 163 | ... ${os_password}=${OS_PASSWORD} |
| 164 | |
| 165 | # Description of argument(s): |
| 166 | # os_host The host name or IP address of the OS. |
| 167 | # os_username The username to be used to sign in to the OS. |
| 168 | # os_password The password to be used to sign in to the OS. |
| 169 | |
| 170 | ${cmd_buf}= Run Keyword If '${os_username}' == 'root' |
| 171 | ... Set Variable reboot |
| 172 | ... ELSE |
| 173 | ... Set Variable echo ${os_password} | sudo -S reboot |
| 174 | |
| 175 | ${output} ${stderr} ${rc}= OS Execute Command |
| 176 | ... ${cmd_buf} fork=${1} |
| 177 | |
| 178 | |
| 179 | Initiate OS Host Power Off |
| 180 | [Documentation] Initiate an OS reboot. |
| 181 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 182 | ... ${os_password}=${OS_PASSWORD} ${hard}=${0} |
| 183 | |
| 184 | # Description of argument(s): |
| 185 | # os_host The DNS name or IP of the OS. |
| 186 | # os_username The username to be used to sign in to the OS. |
| 187 | # os_password The password to be used to sign in to the OS. |
| 188 | # hard Indicates whether to do a hard vs. soft power off. |
| 189 | |
| 190 | ${time_string}= Run Keyword If ${hard} Set Variable ${SPACE}now |
| 191 | ... ELSE Set Variable ${EMPTY} |
| 192 | |
| 193 | ${cmd_buf}= Run Keyword If '${os_username}' == 'root' |
| 194 | ... Set Variable shutdown${time_string} |
| 195 | ... ELSE |
| 196 | ... Set Variable echo ${os_password} | sudo -S shutdown${time_string} |
| 197 | |
| 198 | ${output} ${stderr} ${rc}= OS Execute Command |
| 199 | ... ${cmd_buf} fork=${1} |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 200 | |
George Keishing | 3987a1e | 2017-09-20 09:13:02 -0500 | [diff] [blame] | 201 | |
Steven Sombar | 5f3af44 | 2018-02-14 08:30:15 -0600 | [diff] [blame] | 202 | Set System LED State |
| 203 | [Documentation] Set given system LED via REST. |
| 204 | [Arguments] ${led_name} ${led_state} |
| 205 | # Description of argument(s): |
| 206 | # led_name System LED name (e.g. heartbeat, identify, beep). |
| 207 | # led_state LED state to be set (e.g. On, Off). |
| 208 | |
| 209 | ${args}= Create Dictionary |
| 210 | ... data=xyz.openbmc_project.Led.Physical.Action.${led_state} |
| 211 | Write Attribute ${LED_PHYSICAL_URI}${led_name} State data=${args} |
| 212 | |
| 213 | Verify LED State ${led_name} ${led_state} |
| 214 | |
| 215 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 216 | Read Turbo Setting Via REST |
| 217 | [Documentation] Return turbo setting via REST. |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 218 | # Returns 1 if TurboAllowed, 0 if not. |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 219 | |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 220 | ${turbo_setting}= Read Attribute |
| 221 | ... ${CONTROL_HOST_URI}turbo_allowed TurboAllowed |
| 222 | [Return] ${turbo_setting} |
| 223 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 224 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 225 | Set Turbo Setting Via REST |
| 226 | [Documentation] Set turbo setting via REST. |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 227 | [Arguments] ${setting} ${verify}=${False} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 228 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 229 | # Description of argument(s): |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 230 | # setting State to set TurboAllowed, 1=allowed, 0=not allowed. |
| 231 | # verify If True, read the TurboAllowed setting to confirm. |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 232 | |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 233 | ${data}= Create Dictionary data=${${setting}} |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 234 | Write Attribute ${CONTROL_HOST_URI}turbo_allowed TurboAllowed |
| 235 | ... verify=${verify} data=${data} |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 236 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 237 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 238 | Set REST Logging Policy |
| 239 | [Documentation] Enable or disable REST logging setting. |
| 240 | [Arguments] ${policy_setting}=${True} |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 241 | |
| 242 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 243 | # policy_setting The policy setting value which can be either |
| 244 | # True or False. |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 245 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 246 | ${log_dict}= Create Dictionary data=${policy_setting} |
George Keishing | df3e65f | 2018-12-18 13:06:56 -0600 | [diff] [blame] | 247 | Write Attribute ${BMC_LOGGING_URI}rest_api_logs Enabled |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 248 | ... data=${log_dict} verify=${1} expected_value=${policy_setting} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 249 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 250 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 251 | Old Get Boot Progress |
| 252 | [Documentation] Get the boot progress the old way (via org location). |
| 253 | [Arguments] ${quiet}=${QUIET} |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 254 | |
| 255 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 256 | # quiet Indicates whether this keyword should run without any output to |
| 257 | # the console. |
| 258 | |
| 259 | ${state}= Read Attribute ${OPENBMC_BASE_URI}sensors/host/BootProgress |
| 260 | ... value quiet=${quiet} |
| 261 | |
| 262 | [Return] ${state} |
| 263 | |
| 264 | |
| 265 | Set Boot Progress Method |
| 266 | [Documentation] Set the boot_prog_method to either 'Old' or 'New'. |
| 267 | |
| 268 | # The boot progress data has moved from an 'org' location to an 'xyz' |
| 269 | # location. This keyword will determine whether the new method of getting |
| 270 | # the boot progress is valid and will set the global boot_prog_method |
| 271 | # variable accordingly. If boot_prog_method is already set (either by a |
| 272 | # prior call to this function or via a -v parm), this keyword will simply |
| 273 | # return. |
| 274 | |
| 275 | # Note: There are interim builds that contain boot_progress in both the |
| 276 | # old and the new location values. It is nearly impossible for this |
| 277 | # keyword to determine whether the old boot_progress or the new one is |
| 278 | # active. When using such builds where the old boot_progress is active, |
| 279 | # the only recourse users will have is that they may specify |
| 280 | # -v boot_prog_method:Old to force old behavior on such builds. |
| 281 | |
| 282 | Run Keyword If '${boot_prog_method}' != '${EMPTY}' Return From Keyword |
| 283 | |
| 284 | ${new_status} ${new_value}= Run Keyword And Ignore Error |
| 285 | ... New Get Boot Progress |
| 286 | # If the new style read fails, the method must necessarily be "Old". |
| 287 | Run Keyword If '${new_status}' == 'PASS' |
| 288 | ... Run Keywords |
| 289 | ... Set Global Variable ${boot_prog_method} New AND |
| 290 | ... Rqpvars boot_prog_method AND |
| 291 | ... Return From Keyword |
| 292 | |
| 293 | # Default method is "Old". |
| 294 | Set Global Variable ${boot_prog_method} Old |
| 295 | Rqpvars boot_prog_method |
| 296 | |
| 297 | |
| 298 | Initiate Power On |
| 299 | [Documentation] Initiates the power on and waits until the Is Power On |
| 300 | ... keyword returns that the power state has switched to on. |
| 301 | [Arguments] ${wait}=${1} |
| 302 | |
| 303 | # Description of argument(s): |
| 304 | # wait Indicates whether to wait for a powered on state after issuing |
| 305 | # the power on command. |
| 306 | |
| 307 | @{arglist}= Create List |
| 308 | ${args}= Create Dictionary data=@{arglist} |
| 309 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn |
| 310 | ... data=${args} |
| 311 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 312 | |
| 313 | # Does caller want to wait for power on status? |
| 314 | Run Keyword If '${wait}' == '${0}' Return From Keyword |
| 315 | Wait Until Keyword Succeeds 3 min 10 sec Is Power On |
| 316 | |
| 317 | |
| 318 | Initiate Power Off |
| 319 | [Documentation] Initiates the power off and waits until the Is Power Off |
| 320 | ... keyword returns that the power state has switched to off. |
| 321 | |
| 322 | @{arglist}= Create List |
| 323 | ${args}= Create Dictionary data=@{arglist} |
| 324 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff |
| 325 | ... data=${args} |
| 326 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 327 | Wait Until Keyword Succeeds 1 min 10 sec Is Power Off |
| 328 | |
| 329 | |
| 330 | Get Boot Progress |
| 331 | [Documentation] Get the boot progress and return it. |
| 332 | [Arguments] ${quiet}=${QUIET} |
| 333 | |
| 334 | # Description of argument(s): |
| 335 | # quiet Indicates whether this keyword should run without any output to |
| 336 | # the console. |
| 337 | |
| 338 | Set Boot Progress Method |
| 339 | ${state}= Run Keyword If '${boot_prog_method}' == 'New' |
| 340 | ... New Get Boot Progress quiet=${quiet} |
| 341 | ... ELSE |
| 342 | ... Old Get Boot Progress quiet=${quiet} |
| 343 | |
| 344 | [Return] ${state} |
| 345 | |
| 346 | |
| 347 | New Get Boot Progress |
| 348 | [Documentation] Get the boot progress the new way (via xyz location). |
| 349 | [Arguments] ${quiet}=${QUIET} |
| 350 | |
| 351 | # Description of argument(s): |
| 352 | # quiet Indicates whether this keyword should run without any output to |
| 353 | # the console. |
| 354 | |
| 355 | ${state}= Read Attribute ${HOST_STATE_URI} BootProgress quiet=${quiet} |
| 356 | |
| 357 | [Return] ${state.rsplit('.', 1)[1]} |
| 358 | |
| 359 | |
| 360 | New Get Power Policy |
| 361 | [Documentation] Returns the BMC power policy (new method). |
| 362 | ${currentPolicy}= Read Attribute ${POWER_RESTORE_URI} PowerRestorePolicy |
| 363 | |
| 364 | [Return] ${currentPolicy} |
| 365 | |
| 366 | |
| 367 | Old Get Power Policy |
| 368 | [Documentation] Returns the BMC power policy (old method). |
| 369 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 370 | |
| 371 | [Return] ${currentPolicy} |
| 372 | |
| 373 | |
George Keishing | a54e06f | 2020-06-12 10:42:41 -0500 | [diff] [blame] | 374 | Redfish Get Power Restore Policy |
| 375 | [Documentation] Returns the BMC power restore policy. |
| 376 | |
| 377 | ${power_restore_policy}= Redfish.Get Attribute /redfish/v1/Systems/system PowerRestorePolicy |
| 378 | [Return] ${power_restore_policy} |
| 379 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 380 | Get Auto Reboot |
| 381 | [Documentation] Returns auto reboot setting. |
| 382 | ${setting}= Read Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot |
| 383 | |
| 384 | [Return] ${setting} |
| 385 | |
| 386 | |
George Keishing | c8a6dd2 | 2020-06-12 12:01:33 -0500 | [diff] [blame] | 387 | Redfish Get Auto Reboot |
| 388 | [Documentation] Returns auto reboot setting. |
| 389 | |
George Keishing | a8cb28d | 2020-06-15 03:10:29 -0500 | [diff] [blame] | 390 | ${resp}= Redfish.Get Attribute /redfish/v1/Systems/system Boot |
George Keishing | a8cb28d | 2020-06-15 03:10:29 -0500 | [diff] [blame] | 391 | [Return] ${resp["AutomaticRetryConfig"]} |
George Keishing | c8a6dd2 | 2020-06-12 12:01:33 -0500 | [diff] [blame] | 392 | |
| 393 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 394 | Trigger Warm Reset |
| 395 | [Documentation] Initiate a warm reset. |
| 396 | |
| 397 | log to console "Triggering warm reset" |
| 398 | ${data}= create dictionary data=@{EMPTY} |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 399 | ${resp}= Openbmc Post Request |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 400 | ... ${OPENBMC_BASE_URI}control/bmc0/action/warmReset data=${data} |
| 401 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 402 | ${session_active}= Check If warmReset is Initiated |
| 403 | Run Keyword If '${session_active}' == '${True}' |
| 404 | ... Fail msg=warm reset didn't occur |
| 405 | |
| 406 | Sleep ${SYSTEM_SHUTDOWN_TIME}min |
| 407 | Check If BMC Is Up |
| 408 | |
| 409 | |
| 410 | Get Power State |
| 411 | [Documentation] Returns the power state as an integer. Either 0 or 1. |
| 412 | [Arguments] ${quiet}=${QUIET} |
| 413 | |
| 414 | # Description of argument(s): |
| 415 | # quiet Indicates whether this keyword should run without any output to |
| 416 | # the console. |
| 417 | |
| 418 | @{arglist}= Create List |
| 419 | ${args}= Create Dictionary data=@{arglist} |
| 420 | |
| 421 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ getPowerState |
| 422 | ... data=${args} quiet=${quiet} |
| 423 | Should be equal as strings ${resp.status_code} ${HTTP_OK} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 424 | |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 425 | [Return] ${resp.json()["data"]} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 426 | |
| 427 | |
| 428 | Clear BMC Gard Record |
| 429 | [Documentation] Clear gard records from the system. |
| 430 | |
| 431 | @{arglist}= Create List |
| 432 | ${args}= Create Dictionary data=@{arglist} |
| 433 | ${resp}= Call Method |
| 434 | ... ${OPENPOWER_CONTROL}gard Reset data=${args} |
| 435 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 436 | |
| 437 | |
| 438 | Flash PNOR |
| 439 | [Documentation] Calls flash bios update method to flash PNOR image |
| 440 | [Arguments] ${pnor_image} |
| 441 | |
| 442 | # Description of argument(s): |
| 443 | # pnor_image The filename and path of the PNOR image |
| 444 | # (e.g. "/home/image/zaius.pnor"). |
| 445 | |
| 446 | @{arglist}= Create List ${pnor_image} |
| 447 | ${args}= Create Dictionary data=@{arglist} |
| 448 | ${resp}= Call Method /org/openbmc/control/flash/bios/ update |
| 449 | ... data=${args} |
| 450 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 451 | Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing |
| 452 | |
| 453 | |
| 454 | Get Flash BIOS Status |
| 455 | [Documentation] Returns the status of the flash BIOS API as a string. For |
| 456 | ... example 'Flashing', 'Flash Done', etc |
| 457 | ${data}= Read Properties /org/openbmc/control/flash/bios |
| 458 | [Return] ${data['status']} |
| 459 | |
| 460 | |
| 461 | Is PNOR Flashing |
| 462 | [Documentation] Get BIOS 'Flashing' status. This indicates that PNOR |
| 463 | ... flashing has started. |
| 464 | ${status}= Get Flash BIOS Status |
| 465 | Should Contain ${status} Flashing |
| 466 | |
| 467 | |
| 468 | Is PNOR Flash Done |
| 469 | [Documentation] Get BIOS 'Flash Done' status. This indicates that the |
| 470 | ... PNOR flashing has completed. |
| 471 | ${status}= Get Flash BIOS Status |
| 472 | should be equal as strings ${status} Flash Done |
| 473 | |
| 474 | |
| 475 | Create OS Console File Path |
| 476 | [Documentation] Create OS console file path name and return it. |
| 477 | [Arguments] ${log_file_path}=${EMPTY} |
| 478 | |
| 479 | # Description of arguments: |
| 480 | # file_path The caller's candidate value. If this value is ${EMPTY}, this |
| 481 | # keyword will compose a file path name. Otherwise, this |
| 482 | # keyword will use the caller's file_path value. In either |
| 483 | # case, the value will be returned. |
| 484 | |
| 485 | ${status}= Run Keyword And Return Status Variable Should Exist |
| 486 | ... ${TEST_NAME} |
| 487 | |
| 488 | ${default_file_path}= Set Variable If ${status} == ${TRUE} |
George Keishing | 9161b10 | 2021-12-10 02:26:30 -0600 | [diff] [blame] | 489 | ... ${EXECDIR}${/}tmp${/}${OPENBMC_HOST}_${TEST_NAME.replace(' ', '')}_os_console.txt |
| 490 | ... ${EXECDIR}${/}tmp${/}${OPENBMC_HOST}_os_console.txt |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 491 | |
| 492 | ${log_file_path}= Set Variable If '${log_file_path}' == '${EMPTY}' |
| 493 | ... ${default_file_path} ${log_file_path} |
| 494 | |
| 495 | [Return] ${log_file_path} |
| 496 | |
| 497 | |
| 498 | Get Endpoint Paths |
| 499 | [Documentation] Returns all url paths ending with given endpoint |
| 500 | ... Example: |
| 501 | ... Given the following endpoint: cpu |
| 502 | ... This keyword will return: list of all urls ending with |
| 503 | ... cpu - |
| 504 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu0, |
| 505 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu1 |
| 506 | [Arguments] ${path} ${endpoint} |
| 507 | |
| 508 | # Description of arguments: |
| 509 | # path URL path for enumeration. |
| 510 | # endpoint Endpoint string (url path ending). |
| 511 | |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 512 | # Make sure path ends with slash. |
| 513 | ${path}= Add Trailing Slash ${path} |
| 514 | |
| 515 | ${resp}= Read Properties ${path}enumerate timeout=30 |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 516 | Log Dictionary ${resp} |
| 517 | |
| 518 | ${list}= Get Dictionary Keys ${resp} |
| 519 | # For a given string, look for prefix and suffix for matching expression. |
| 520 | # Start of string followed by zero or more of any character followed by |
| 521 | # any digit or lower case character. |
George Keishing | 585afa3 | 2020-07-09 04:55:15 -0500 | [diff] [blame] | 522 | ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}\[_0-9a-z]*$ case_insensitive=${True} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 523 | |
| 524 | [Return] ${resp} |
| 525 | |
| 526 | |
| 527 | Set BMC Power Policy |
| 528 | [Documentation] Set the given BMC power policy. |
| 529 | [Arguments] ${policy} |
| 530 | |
| 531 | # Note that this function will translate the old style "RESTORE_LAST_STATE" |
| 532 | # policy to the new style "xyz.openbmc_project.Control.Power.RestorePolicy. |
| 533 | # Policy.Restore" for you. |
| 534 | |
| 535 | # Description of argument(s): |
| 536 | # policy Power restore policy (e.g "RESTORE_LAST_STATE", |
| 537 | # ${RESTORE_LAST_STATE}). |
| 538 | |
| 539 | # Set the bmc_power_policy_method to either 'Old' or 'New'. |
| 540 | Set Power Policy Method |
| 541 | # This translation helps bridge between old and new method for calling. |
| 542 | ${policy}= Translate Power Policy Value ${policy} |
| 543 | # Run the appropriate keyword. |
| 544 | Run Key ${bmc_power_policy_method} Set Power Policy \ ${policy} |
| 545 | ${currentPolicy}= Get System Power Policy |
| 546 | Should Be Equal ${currentPolicy} ${policy} |
| 547 | |
| 548 | |
| 549 | Delete Error Logs |
| 550 | [Documentation] Delete error logs. |
Michael Shepos | cc490b4 | 2020-08-26 12:53:01 -0500 | [diff] [blame] | 551 | [Arguments] ${quiet}=${0} |
| 552 | # Description of argument(s): |
| 553 | # quiet If enabled, turns off logging to console. |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 554 | |
| 555 | # Check if error logs entries exist, if not return. |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 556 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}list quiet=${1} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 557 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 558 | |
| 559 | # Get the list of error logs entries and delete them all. |
| 560 | ${elog_entries}= Get URL List ${BMC_LOGGING_ENTRY} |
David Shaw | 79247e4 | 2020-06-18 17:16:02 -0500 | [diff] [blame] | 561 | FOR ${entry} IN @{elog_entries} |
Michael Shepos | cc490b4 | 2020-08-26 12:53:01 -0500 | [diff] [blame] | 562 | Delete Error Log Entry ${entry} quiet=${quiet} |
David Shaw | 79247e4 | 2020-06-18 17:16:02 -0500 | [diff] [blame] | 563 | END |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 564 | |
| 565 | |
| 566 | Delete All Error Logs |
| 567 | [Documentation] Delete all error log entries using "DeleteAll" interface. |
| 568 | |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 569 | ${args}= Set Variable {"data": []} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 570 | ${resp}= Openbmc Post Request ${BMC_LOGGING_URI}action/DeleteAll |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 571 | ... data=${args} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 572 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 573 | |
| 574 | |
| 575 | Get Elog URL List |
| 576 | [Documentation] Return error log entry list of URLs. |
| 577 | |
| 578 | ${url_list}= Read Properties /xyz/openbmc_project/logging/entry/ |
| 579 | Sort List ${url_list} |
| 580 | [Return] ${url_list} |
| 581 | |
| 582 | |
| 583 | Get BMC Flash Chip Boot Side |
| 584 | [Documentation] Return the BMC flash chip boot side. |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 585 | |
| 586 | # Example: |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 587 | # 0 - indicates chip select is current side. |
| 588 | # 32 - indicates chip select is alternate side. |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 589 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 590 | ${boot_side} ${stderr} ${rc}= BMC Execute Command |
| 591 | ... cat /sys/class/watchdog/watchdog1/bootstatus |
| 592 | |
| 593 | [Return] ${boot_side} |
| 594 | |
| 595 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 596 | Watchdog Object Should Exist |
| 597 | [Documentation] Check that watchdog object exists. |
| 598 | |
| 599 | ${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0 |
| 600 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 601 | ... msg=Expected watchdog object does not exist. |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 602 | |
| 603 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 604 | Get System LED State |
| 605 | [Documentation] Return the state of given system LED. |
| 606 | [Arguments] ${led_name} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 607 | |
| 608 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 609 | # led_name System LED name (e.g. heartbeat, identify, beep). |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 610 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 611 | ${state}= Read Attribute ${LED_PHYSICAL_URI}${led_name} State |
| 612 | [Return] ${state.rsplit('.', 1)[1]} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 613 | |
| 614 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 615 | Verify LED State |
| 616 | [Documentation] Checks if LED is in given state. |
| 617 | [Arguments] ${led_name} ${led_state} |
| 618 | # Description of argument(s): |
| 619 | # led_name System LED name (e.g. heartbeat, identify, beep). |
| 620 | # led_state LED state to be verified (e.g. On, Off). |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 621 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 622 | ${state}= Get System LED State ${led_name} |
| 623 | Should Be Equal ${state} ${led_state} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 624 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 625 | |
| 626 | Get LED State XYZ |
| 627 | [Documentation] Returns state of given LED. |
| 628 | [Arguments] ${led_name} |
| 629 | |
| 630 | # Description of argument(s): |
| 631 | # led_name Name of LED. |
| 632 | |
| 633 | ${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted |
| 634 | # Returns the state of the LED, either On or Off. |
| 635 | [Return] ${state} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 636 | |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 637 | |
| 638 | Verify Identify LED State |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 639 | [Documentation] Verify that the identify state of the LED group matches caller's expectations. |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 640 | [Arguments] ${expected_state} |
| 641 | |
| 642 | # Description of argument(s): |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 643 | # expected_state The expected LED asserted state (1 = asserted, 0 = not asserted). |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 644 | |
Alvin Wang | 32f7b3d | 2019-07-25 02:05:39 -0500 | [diff] [blame] | 645 | ${led_state}= Get LED State XYZ enclosure_identify |
| 646 | Should Be Equal ${led_state} ${expected_state} msg=Unexpected LED state. |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 647 | |
| 648 | Verify The Attribute |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 649 | [Documentation] Verify the given attribute. |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 650 | [Arguments] ${uri} ${attribute_name} ${attribute_value} |
| 651 | |
| 652 | # Description of argument(s): |
| 653 | # uri URI path |
| 654 | # (e.g. "/xyz/openbmc_project/control/host0/TPMEnable"). |
| 655 | # attribute_name Name of attribute to be verified (e.g. "TPMEnable"). |
| 656 | # attribute_value The expected value of attribute (e.g. "1", "0", etc.) |
| 657 | |
| 658 | ${output}= Read Attribute ${uri} ${attribute_name} |
| 659 | Should Be Equal ${attribute_value} ${output} |
| 660 | ... msg=Attribute "${attribute_name} does not have the expected value. |
George Keishing | cf0d777 | 2018-05-04 08:22:50 -0500 | [diff] [blame] | 661 | |
| 662 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 663 | New Set Power Policy |
| 664 | [Documentation] Set the given BMC power policy (new method). |
| 665 | [Arguments] ${policy} |
George Keishing | b4adfc7 | 2018-10-26 09:39:32 -0500 | [diff] [blame] | 666 | |
| 667 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 668 | # policy Power restore policy (e.g. ${ALWAYS_POWER_OFF}). |
George Keishing | c5fef58 | 2018-07-18 08:41:28 -0500 | [diff] [blame] | 669 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 670 | ${valueDict}= Create Dictionary data=${policy} |
| 671 | Write Attribute |
| 672 | ... ${POWER_RESTORE_URI} PowerRestorePolicy data=${valueDict} |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 673 | |
| 674 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 675 | Old Set Power Policy |
| 676 | [Documentation] Set the given BMC power policy (old method). |
| 677 | [Arguments] ${policy} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 678 | |
| 679 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 680 | # policy Power restore policy (e.g. "ALWAYS_POWER_OFF"). |
| 681 | |
| 682 | ${valueDict}= create dictionary data=${policy} |
| 683 | Write Attribute ${HOST_SETTING} power_policy data=${valueDict} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 684 | |
| 685 | |
George Keishing | a54e06f | 2020-06-12 10:42:41 -0500 | [diff] [blame] | 686 | Redfish Set Power Restore Policy |
| 687 | [Documentation] Set the BMC power restore policy. |
| 688 | [Arguments] ${power_restore_policy} |
| 689 | |
| 690 | # Description of argument(s): |
| 691 | # power_restore_policy Power restore policy (e.g. "AlwaysOff", "AlwaysOn", "LastState"). |
| 692 | |
| 693 | Redfish.Patch /redfish/v1/Systems/system body={"PowerRestorePolicy": "${power_restore_policy}"} |
| 694 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 695 | |
| 696 | |
George Keishing | 9a28860 | 2021-12-10 04:50:25 -0600 | [diff] [blame] | 697 | IPMI Set Power Restore Policy |
| 698 | [Documentation] Set the BMC power restore policy using IPMI. |
| 699 | [Arguments] ${power_restore_policy}=always-off |
| 700 | |
| 701 | # Description of argument(s): |
| 702 | # power_restore_policy Power restore policies |
| 703 | # always-on : turn on when power is restored |
| 704 | # previous : return to previous state when power is restored |
| 705 | # always-off : stay off after power is restored |
| 706 | |
| 707 | ${resp}= Run IPMI Standard Command chassis policy ${power_restore_policy} |
| 708 | # Example: Set chassis power restore policy to always-off |
| 709 | Should Contain ${resp} ${power_restore_policy} |
| 710 | |
| 711 | |
George Keishing | a5cedb3 | 2020-07-17 15:50:34 -0500 | [diff] [blame] | 712 | Set Auto Reboot Setting |
| 713 | [Documentation] Set the given auto reboot setting (REST or Redfish). |
| 714 | [Arguments] ${value} |
| 715 | |
| 716 | # Description of argument(s): |
| 717 | # value The reboot setting, 1 for enabling and 0 for disabling. |
| 718 | |
| 719 | # This is to cater to boot call points and plugin script which will always |
| 720 | # send using value 0 or 1. This dictionary maps to redfish string values. |
| 721 | ${rest_redfish_dict}= Create Dictionary |
| 722 | ... 1=RetryAttempts |
| 723 | ... 0=Disabled |
| 724 | |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 725 | Run Keyword If ${REDFISH_SUPPORT_TRANS_STATE} == ${1} |
George Keishing | a5cedb3 | 2020-07-17 15:50:34 -0500 | [diff] [blame] | 726 | ... Redfish Set Auto Reboot ${rest_redfish_dict["${value}"]} |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 727 | ... ELSE |
| 728 | ... Set Auto Reboot ${value} |
George Keishing | a5cedb3 | 2020-07-17 15:50:34 -0500 | [diff] [blame] | 729 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 730 | Set Auto Reboot |
| 731 | [Documentation] Set the given auto reboot setting. |
| 732 | [Arguments] ${setting} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 733 | |
| 734 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 735 | # setting The reboot setting, 1 for enabling and 0 for disabling. |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 736 | |
Sridevi Ramesh | 68d72ff | 2019-02-04 09:24:46 -0600 | [diff] [blame] | 737 | ${valueDict}= Convert To Integer ${setting} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 738 | ${data}= Create Dictionary data=${valueDict} |
| 739 | Write Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot data=${data} |
| 740 | ${current_setting}= Get Auto Reboot |
| 741 | Should Be Equal As Integers ${current_setting} ${setting} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 742 | |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 743 | |
George Keishing | c8a6dd2 | 2020-06-12 12:01:33 -0500 | [diff] [blame] | 744 | Redfish Set Auto Reboot |
| 745 | [Documentation] Set the given auto reboot setting. |
| 746 | [Arguments] ${setting} |
| 747 | |
| 748 | # Description of argument(s): |
| 749 | # setting The reboot setting, "RetryAttempts" and "Disabled". |
| 750 | |
George Keishing | a8cb28d | 2020-06-15 03:10:29 -0500 | [diff] [blame] | 751 | Redfish.Patch /redfish/v1/Systems/system body={"Boot": {"AutomaticRetryConfig": "${setting}"}} |
| 752 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
George Keishing | a8cb28d | 2020-06-15 03:10:29 -0500 | [diff] [blame] | 753 | |
George Keishing | c8a6dd2 | 2020-06-12 12:01:33 -0500 | [diff] [blame] | 754 | ${current_setting}= Redfish Get Auto Reboot |
| 755 | Should Be Equal As Strings ${current_setting} ${setting} |
| 756 | |
| 757 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 758 | Set Control Boot Mode |
| 759 | [Documentation] Set given boot mode on the boot object path attribute. |
| 760 | [Arguments] ${boot_path} ${boot_mode} |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 761 | |
| 762 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 763 | # boot_path Boot object path. |
| 764 | # Example: |
| 765 | # /xyz/openbmc_project/control/host0/boot |
| 766 | # /xyz/openbmc_project/control/host0/boot/one_time |
| 767 | # boot_mode Boot mode which need to be set. |
| 768 | # Example: |
| 769 | # "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular" |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 770 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 771 | ${valueDict}= Create Dictionary data=${boot_mode} |
| 772 | Write Attribute ${boot_path} BootMode data=${valueDict} |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 773 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 774 | |
| 775 | Is Power On |
| 776 | [Documentation] Verify that the BMC chassis state is on. |
| 777 | ${state}= Get Power State |
| 778 | Should be equal ${state} ${1} |
| 779 | |
| 780 | |
| 781 | Is Power Off |
| 782 | [Documentation] Verify that the BMC chassis state is off. |
| 783 | ${state}= Get Power State |
| 784 | Should be equal ${state} ${0} |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 785 | |
| 786 | |
| 787 | CLI Get BMC DateTime |
| 788 | [Documentation] Returns BMC date time from date command. |
| 789 | |
| 790 | ${bmc_time_via_date} ${stderr} ${rc}= BMC Execute Command date +"%Y-%m-%d %H:%M:%S" print_err=1 |
| 791 | [Return] ${bmc_time_via_date} |
George Keishing | 61364e5 | 2019-10-01 12:01:19 -0500 | [diff] [blame] | 792 | |
| 793 | |
| 794 | Update Root Password |
| 795 | [Documentation] Update system "root" user password. |
| 796 | [Arguments] ${openbmc_password}=${OPENBMC_PASSWORD} |
| 797 | |
| 798 | # Description of argument(s): |
| 799 | # openbmc_password The root password for the open BMC system. |
| 800 | |
| 801 | @{password}= Create List ${openbmc_password} |
| 802 | ${data}= Create Dictionary data=@{password} |
| 803 | |
| 804 | ${headers}= Create Dictionary Content-Type=application/json X-Auth-Token=${XAUTH_TOKEN} |
George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 805 | ${resp}= POST On Session openbmc ${BMC_USER_URI}root/action/SetPassword |
George Keishing | 61364e5 | 2019-10-01 12:01:19 -0500 | [diff] [blame] | 806 | ... data=${data} headers=${headers} |
| 807 | Valid Value resp.status_code [${HTTP_OK}] |
Sushil Singh | 6624ce5 | 2020-01-22 00:53:41 -0600 | [diff] [blame] | 808 | |
| 809 | |
| 810 | Get Post Boot Action |
| 811 | [Documentation] Get post boot action. |
| 812 | |
George Keishing | 879f084 | 2020-02-05 11:00:47 -0600 | [diff] [blame] | 813 | # Post code update action dictionary. |
Sushil Singh | 6624ce5 | 2020-01-22 00:53:41 -0600 | [diff] [blame] | 814 | # |
| 815 | # { |
| 816 | # BMC image: { |
| 817 | # OnReset: Redfish OBMC Reboot (off), |
| 818 | # Immediate: Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 819 | # }, |
| 820 | # Host image: { |
George Keishing | e523fc0 | 2020-03-23 12:28:01 -0500 | [diff] [blame] | 821 | # OnReset: RF SYS GracefulRestart, |
Sushil Singh | 6624ce5 | 2020-01-22 00:53:41 -0600 | [diff] [blame] | 822 | # Immediate: Wait State os_running_match_state 10 mins |
| 823 | # } |
| 824 | # } |
| 825 | |
| 826 | ${code_base_dir_path}= Get Code Base Dir Path |
| 827 | ${post_code_update_actions}= Evaluate |
| 828 | ... json.load(open('${code_base_dir_path}data/applytime_table.json')) modules=json |
| 829 | Rprint Vars post_code_update_actions |
| 830 | |
| 831 | [Return] ${post_code_update_actions} |
| 832 | |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 833 | |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 834 | Get Task State From File |
| 835 | [Documentation] Get task states from pre-define data/task_state.json file. |
| 836 | |
| 837 | # Example: Task state JSON format. |
| 838 | # |
| 839 | # { |
| 840 | # "TaskRunning": { |
| 841 | # "TaskState": "Running", |
| 842 | # "TaskStatus": "OK" |
| 843 | # }, |
| 844 | # "TaskCompleted": { |
| 845 | # "TaskState": "Completed", |
| 846 | # "TaskStatus": "OK" |
| 847 | # }, |
| 848 | # "TaskException": { |
| 849 | # "TaskState": "Exception", |
| 850 | # "TaskStatus": "Warning" |
| 851 | # } |
| 852 | # } |
| 853 | |
| 854 | # Python module: get_code_base_dir_path() |
| 855 | ${code_base_dir_path}= Get Code Base Dir Path |
| 856 | ${task_state}= Evaluate |
| 857 | ... json.load(open('${code_base_dir_path}data/task_state.json')) modules=json |
| 858 | Rprint Vars task_state |
| 859 | |
| 860 | [Return] ${task_state} |
| 861 | |
| 862 | |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 863 | Redfish Set Boot Default |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 864 | [Documentation] Set and Verify Boot source override |
| 865 | [Arguments] ${override_enabled} ${override_target} ${override_mode}=UEFI |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 866 | |
| 867 | # Description of argument(s): |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 868 | # override_enabled Boot source override enable type. |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 869 | # ('Once', 'Continuous', 'Disabled'). |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 870 | # override_target Boot source override target. |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 871 | # ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None'). |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 872 | # override_mode Boot source override mode (relevant only for x86 arch). |
| 873 | # ('Legacy', 'UEFI'). |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 874 | |
| 875 | ${data}= Create Dictionary BootSourceOverrideEnabled=${override_enabled} |
| 876 | ... BootSourceOverrideTarget=${override_target} |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 877 | |
| 878 | Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' |
| 879 | ... Set To Dictionary ${data} BootSourceOverrideMode ${override_mode} |
| 880 | |
George Keishing | 1eeff9c | 2020-06-16 04:03:34 -0500 | [diff] [blame] | 881 | ${payload}= Create Dictionary Boot=${data} |
| 882 | |
| 883 | Redfish.Patch /redfish/v1/Systems/system body=&{payload} |
| 884 | ... valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] |
| 885 | |
| 886 | ${resp}= Redfish.Get Attribute /redfish/v1/Systems/system Boot |
| 887 | Should Be Equal As Strings ${resp["BootSourceOverrideEnabled"]} ${override_enabled} |
| 888 | Should Be Equal As Strings ${resp["BootSourceOverrideTarget"]} ${override_target} |
Konstantin Aladyshev | 0043fc5 | 2021-04-15 12:07:29 +0300 | [diff] [blame] | 889 | Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' |
| 890 | ... Should Be Equal As Strings ${resp["BootSourceOverrideMode"]} ${override_mode} |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 891 | |
| 892 | |
| 893 | # Redfish state keywords. |
| 894 | |
| 895 | Redfish Get BMC State |
| 896 | [Documentation] Return BMC health state. |
| 897 | |
| 898 | # "Enabled" -> BMC Ready, "Starting" -> BMC NotReady |
| 899 | |
| 900 | # Example: |
| 901 | # "Status": { |
| 902 | # "Health": "OK", |
| 903 | # "HealthRollup": "OK", |
| 904 | # "State": "Enabled" |
| 905 | # }, |
| 906 | |
| 907 | ${status}= Redfish.Get Attribute /redfish/v1/Managers/bmc Status |
| 908 | [Return] ${status["State"]} |
| 909 | |
| 910 | |
| 911 | Redfish Get Host State |
| 912 | [Documentation] Return host power and health state. |
| 913 | |
| 914 | # Refer: http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Status |
| 915 | |
| 916 | # Example: |
| 917 | # "PowerState": "Off", |
| 918 | # "Status": { |
| 919 | # "Health": "OK", |
| 920 | # "HealthRollup": "OK", |
| 921 | # "State": "StandbyOffline" |
| 922 | # }, |
| 923 | |
George Keishing | b51d150 | 2021-03-25 03:30:33 -0500 | [diff] [blame] | 924 | ${chassis}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID} |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 925 | [Return] ${chassis["PowerState"]} ${chassis["Status"]["State"]} |
| 926 | |
| 927 | |
| 928 | Redfish Get Boot Progress |
| 929 | [Documentation] Return boot progress state. |
| 930 | |
| 931 | # Example: /redfish/v1/Systems/system/ |
| 932 | # "BootProgress": { |
| 933 | # "LastState": "OSRunning" |
| 934 | # }, |
| 935 | |
| 936 | ${boot_progress}= Redfish.Get Properties /redfish/v1/Systems/system/ |
George Keishing | b51d150 | 2021-03-25 03:30:33 -0500 | [diff] [blame] | 937 | |
| 938 | Return From Keyword If "${PLATFORM_ARCH_TYPE}" == "x86" |
| 939 | ... NA ${boot_progress["Status"]["State"]} |
| 940 | |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 941 | [Return] ${boot_progress["BootProgress"]["LastState"]} ${boot_progress["Status"]["State"]} |
| 942 | |
| 943 | |
| 944 | Redfish Get States |
| 945 | [Documentation] Return all the BMC and host states in dictionary. |
George Keishing | 366033f | 2021-04-01 13:49:06 -0500 | [diff] [blame] | 946 | [Timeout] 120 Seconds |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 947 | |
| 948 | # Refer: openbmc/docs/designs/boot-progress.md |
| 949 | |
George Keishing | 205f95f | 2021-03-10 02:25:53 -0600 | [diff] [blame] | 950 | Redfish.Login |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 951 | |
| 952 | ${bmc_state}= Redfish Get BMC State |
| 953 | ${chassis_state} ${chassis_status}= Redfish Get Host State |
| 954 | ${boot_progress} ${host_state}= Redfish Get Boot Progress |
| 955 | |
| 956 | ${states}= Create Dictionary |
| 957 | ... bmc=${bmc_state} |
| 958 | ... chassis=${chassis_state} |
| 959 | ... host=${host_state} |
| 960 | ... boot_progress=${boot_progress} |
| 961 | |
George Keishing | 64293c5 | 2021-03-24 08:21:23 -0500 | [diff] [blame] | 962 | # Disable loggoing state to prevent huge log.html record when boot |
| 963 | # test is run in loops. |
| 964 | #Log ${states} |
George Keishing | 95cf865 | 2021-02-08 11:32:33 -0600 | [diff] [blame] | 965 | |
George Keishing | e187964 | 2020-12-09 13:20:15 -0600 | [diff] [blame] | 966 | [Return] ${states} |
George Keishing | 95cf865 | 2021-02-08 11:32:33 -0600 | [diff] [blame] | 967 | |
| 968 | |
| 969 | Is BMC Standby |
| 970 | [Documentation] Check if BMC is ready and host at standby. |
| 971 | |
| 972 | ${standby_states}= Create Dictionary |
| 973 | ... bmc=Enabled |
| 974 | ... chassis=Off |
| 975 | ... host=Disabled |
| 976 | ... boot_progress=None |
| 977 | |
aravinth0510 | de1863d | 2022-06-27 17:26:14 +0000 | [diff] [blame] | 978 | Run Keyword If '${PLATFORM_ARCH_TYPE}' == 'x86' |
| 979 | ... Set To Dictionary ${standby_states} boot_progress=NA |
| 980 | |
George Keishing | 95cf865 | 2021-02-08 11:32:33 -0600 | [diff] [blame] | 981 | Wait Until Keyword Succeeds 3 min 10 sec Redfish Get States |
| 982 | |
Sushil Singh | b910d89 | 2021-11-17 05:34:29 -0600 | [diff] [blame] | 983 | Wait Until Keyword Succeeds 2 min 10 sec Match State ${standby_states} |
George Keishing | 95cf865 | 2021-02-08 11:32:33 -0600 | [diff] [blame] | 984 | |
| 985 | |
| 986 | Match State |
| 987 | [Documentation] Check if the expected and current states are matched. |
| 988 | [Arguments] ${match_state} |
| 989 | |
| 990 | # Description of argument(s): |
| 991 | # match_state Expected states in dictionary. |
| 992 | |
| 993 | ${current_state}= Redfish Get States |
| 994 | Dictionaries Should Be Equal ${match_state} ${current_state} |
Peter D Phan | 49739b2 | 2021-09-29 14:30:08 -0500 | [diff] [blame] | 995 | |
| 996 | |
| 997 | Redfish Initiate Auto Reboot |
| 998 | [Documentation] Initiate an auto reboot. |
| 999 | [Arguments] ${interval}=2000 |
| 1000 | |
| 1001 | # Description of argument(s): |
| 1002 | # interval Value in milliseconds to set Watchdog interval |
| 1003 | |
| 1004 | # Set auto reboot policy |
| 1005 | Redfish Set Auto Reboot RetryAttempts |
| 1006 | |
George Keishing | c070110 | 2021-09-30 12:12:04 -0500 | [diff] [blame] | 1007 | Redfish Power Operation On |
George Keishing | a4e1352 | 2022-04-13 11:14:53 -0500 | [diff] [blame] | 1008 | |
| 1009 | Wait Until Keyword Succeeds 2 min 5 sec Is Boot Progress Changed |
George Keishing | c070110 | 2021-09-30 12:12:04 -0500 | [diff] [blame] | 1010 | |
Peter D Phan | 49739b2 | 2021-09-29 14:30:08 -0500 | [diff] [blame] | 1011 | # Set watchdog timer |
| 1012 | Set Watchdog Interval Using Busctl ${interval} |
| 1013 | |
| 1014 | |
George Keishing | a4e1352 | 2022-04-13 11:14:53 -0500 | [diff] [blame] | 1015 | Is Boot Progress Changed |
| 1016 | [Documentation] Get BootProgress state and expect boot state mismatch. |
| 1017 | [Arguments] ${boot_state}=None |
| 1018 | |
| 1019 | # Description of argument(s): |
| 1020 | # boot_state Value of the BootProgress state to match against. |
| 1021 | |
| 1022 | ${boot_progress} ${host_state}= Redfish Get Boot Progress |
| 1023 | |
| 1024 | Should Not Be Equal ${boot_progress} ${boot_state} |
| 1025 | |
Peter D Phan | 49739b2 | 2021-09-29 14:30:08 -0500 | [diff] [blame] | 1026 | |
| 1027 | Set Watchdog Interval Using Busctl |
| 1028 | [Documentation] Set Watchdog time interval. |
| 1029 | [Arguments] ${milliseconds}=1000 |
| 1030 | |
| 1031 | # Description of argument(s): |
George Keishing | 4b72949 | 2021-11-10 12:51:10 -0600 | [diff] [blame] | 1032 | # milliseconds Time interval for watchdog timer |
Peter D Phan | 49739b2 | 2021-09-29 14:30:08 -0500 | [diff] [blame] | 1033 | |
George Keishing | c070110 | 2021-09-30 12:12:04 -0500 | [diff] [blame] | 1034 | ${cmd}= Catenate busctl set-property xyz.openbmc_project.Watchdog |
| 1035 | ... /xyz/openbmc_project/watchdog/host0 |
| 1036 | ... xyz.openbmc_project.State.Watchdog Interval t ${milliseconds} |
Peter D Phan | 49739b2 | 2021-09-29 14:30:08 -0500 | [diff] [blame] | 1037 | BMC Execute Command ${cmd} |
| 1038 | |
George Keishing | f5fec0d | 2021-10-08 12:38:45 -0500 | [diff] [blame] | 1039 | |
| 1040 | Stop PLDM Service And Wait |
| 1041 | [Documentation] Stop PLDM service and wait for Host to initiate reset. |
| 1042 | |
| 1043 | BMC Execute Command systemctl stop pldmd.service |
| 1044 | |
George Keishing | ca76e37 | 2022-03-16 12:45:26 -0500 | [diff] [blame] | 1045 | |
| 1046 | Get BIOS Attribute |
| 1047 | [Documentation] Get the BIOS attribute for /redfish/v1/Systems/system/Bios. |
| 1048 | |
| 1049 | # Python module: get_member_list(resource_path) |
| 1050 | ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems |
| 1051 | ${bios_attr_dict}= Redfish.Get Attribute ${systems[0]}/Bios Attributes |
| 1052 | |
| 1053 | [Return] ${bios_attr_dict} |
nagarjunb22 | cfb2c41 | 2022-03-15 15:49:27 +0530 | [diff] [blame] | 1054 | |
George Keishing | 8f610e7 | 2022-03-28 10:43:08 -0500 | [diff] [blame] | 1055 | |
| 1056 | Set BIOS Attribute |
| 1057 | [Documentation] PATCH the BIOS attribute for /redfish/v1/Systems/system/Bios. |
| 1058 | [Arguments] ${attribute_name} ${attribute_value} |
| 1059 | |
| 1060 | # Description of argument(s): |
| 1061 | # attribute_name Any valid BIOS attribute. |
| 1062 | # attribute_value Valid allowed attribute values. |
| 1063 | |
| 1064 | # Python module: get_member_list(resource_path) |
| 1065 | ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems |
| 1066 | Redfish.Patch ${systems[0]}/Bios/Settings body={"Attributes":{"${attribute_name}":"${attribute_value}"}} |
| 1067 | |
| 1068 | |
nagarjunb22 | cfb2c41 | 2022-03-15 15:49:27 +0530 | [diff] [blame] | 1069 | Is BMC Operational |
| 1070 | [Documentation] Check if BMC is enabled. |
| 1071 | |
| 1072 | ${bmc_status} = Redfish Get BMC State |
| 1073 | Should Be Equal ${bmc_status} Enabled |
George Keishing | 83c737b | 2022-05-17 12:12:04 -0500 | [diff] [blame] | 1074 | |
| 1075 | |
| 1076 | PLDM Set BIOS Attribute |
| 1077 | [Documentation] Set the BIOS attribute via pldmtool and verify the attribute is set. |
| 1078 | ... Defaulted for fw_boot_side for boot test usage caller. |
| 1079 | [Arguments] ${attribute_name}=fw_boot_side ${attribute_value}=Temp |
| 1080 | |
| 1081 | # Description of argument(s): |
| 1082 | # attribute_name Valid BIOS attribute name e.g ("fw_boot_side") |
| 1083 | # attribute_value Valid BIOS attribute value for fw_boot_side. |
| 1084 | |
| 1085 | # PLDM response output example: |
| 1086 | # { |
| 1087 | # "Response": "SUCCESS" |
| 1088 | # } |
| 1089 | |
| 1090 | ${resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attribute_name} -d ${attribute_value} |
| 1091 | Should Be Equal As Strings ${resp["Response"]} SUCCESS |
| 1092 | |
| 1093 | # PLDM GET output example: |
| 1094 | # { |
| 1095 | # "CurrentValue": "Temp" |
| 1096 | # } |
| 1097 | |
| 1098 | ${pldm_output}= PLDM Get BIOS Attribute ${attribute_name} |
| 1099 | Should Be Equal As Strings ${pldm_output["CurrentValue"]} ${attribute_value} |
| 1100 | ... msg=Expecting ${attribute_value} but got ${pldm_output["CurrentValue"]} |
| 1101 | |
| 1102 | |
| 1103 | PLDM Get BIOS Attribute |
| 1104 | [Documentation] Get the BIOS attribute via pldmtool for a given attribute and return value. |
| 1105 | [Arguments] ${attribute_name} |
| 1106 | |
| 1107 | # Description of argument(s): |
| 1108 | # attribute_name Valid BIOS attribute name e.g ("fw_boot_side") |
| 1109 | |
| 1110 | ${pldm_output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attribute_name} |
| 1111 | [Return] ${pldm_output} |
ganesanb | 29a2421 | 2022-05-11 19:49:40 +0530 | [diff] [blame] | 1112 | Wait Until Keyword Succeeds 5 min 5 sec Ping Host ${OPENBMC_HOST} |
| 1113 | Redfish.login |
| 1114 | ${bmc_status}= Redfish.Get Attribute /redfish/v1/Managers/bmc Status |
| 1115 | Should Be Equal ${bmc_status["State"]} Enabled |
nagarjunb22 | 00108dc | 2022-07-12 21:50:45 +0530 | [diff] [blame] | 1116 | |
| 1117 | |
| 1118 | Verify Host Power State |
| 1119 | [Documentation] Get the Host Power state and compare it with the expected state. |
| 1120 | [Arguments] ${expected_power_state} |
| 1121 | |
| 1122 | # Description of argument(s): |
| 1123 | # expected_power_state State of Host e.g. Off or On. |
| 1124 | |
| 1125 | ${power_state} ${health_status}= Redfish Get Host State |
| 1126 | Should Be Equal ${power_state} ${expected_power_state} |
| 1127 | |
| 1128 | |
| 1129 | Verify Host Is Up |
| 1130 | [Documentation] Verify Host is Up. |
| 1131 | |
| 1132 | Wait Until Keyword Succeeds 3 min 30 sec Verify Host Power State On |
| 1133 | # Python module: os_execute(cmd) |
| 1134 | Wait Until Keyword Succeeds 10 min 30 sec OS Execute Command uptime |