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