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 |
Michael Walsh | 391ba9b | 2017-08-24 11:36:24 -0500 | [diff] [blame] | 10 | Library String |
George Keishing | 30c12ff | 2016-09-02 10:25:29 -0500 | [diff] [blame] | 11 | Library DateTime |
| 12 | Library Process |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 13 | Library OperatingSystem |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 14 | Library gen_print.py |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 15 | Library gen_misc.py |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 16 | Library gen_robot_print.py |
Michael Walsh | 5f3f414 | 2017-05-22 17:09:47 -0500 | [diff] [blame] | 17 | Library gen_cmd.py |
Sunil M | acd110a | 2017-05-23 04:14:32 -0500 | [diff] [blame] | 18 | Library gen_robot_keyword.py |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 19 | Library bmc_ssh_utils.py |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 20 | Library utils.py |
Charles Paul Hofer | 3581615 | 2017-10-02 11:55:11 -0500 | [diff] [blame] | 21 | Library var_funcs.py |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 22 | Library SCPLibrary WITH NAME scp |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 23 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 24 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 25 | *** Variables *** |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 26 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 27 | ${SYSTEM_SHUTDOWN_TIME} ${5} |
| 28 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 29 | # Assign default value to QUIET for programs which may not define it. |
| 30 | ${QUIET} ${0} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 31 | |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 32 | ${HOST_SETTING} ${SETTINGS_URI}host0 |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 33 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 34 | ${boot_prog_method} ${EMPTY} |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 35 | ${power_policy_setup} ${0} |
| 36 | ${bmc_power_policy_method} ${EMPTY} |
Michael Walsh | fdc5ced | 2017-08-17 13:15:15 -0500 | [diff] [blame] | 37 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 38 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | *** Keywords *** |
Sridevi Ramesh | 1699d37 | 2016-12-06 00:20:22 -0600 | [diff] [blame] | 40 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 41 | |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 42 | Verify Ping and REST Authentication |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 43 | [Documentation] Verify ping and rest authentication. |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 44 | ${l_ping}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 45 | ... Ping Host ${OPENBMC_HOST} |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 46 | Run Keyword If '${l_ping}' == '${False}' |
| 47 | ... Fail msg=Ping Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 48 | |
Michael Walsh | a6723f2 | 2016-11-22 11:12:01 -0600 | [diff] [blame] | 49 | ${l_rest}= Run Keyword And Return Status |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 50 | ... Initialize OpenBMC |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 51 | Run Keyword If '${l_rest}' == '${False}' |
| 52 | ... Fail msg=REST Authentication Failed |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 53 | |
| 54 | # Just to make sure the SSH is working for SCP |
| 55 | Open Connection And Log In |
| 56 | ${system} ${stderr}= Execute Command hostname return_stderr=True |
| 57 | Should Be Empty ${stderr} |
| 58 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 59 | |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 60 | Check If BMC is Up |
| 61 | [Documentation] Wait for Host to be online. Checks every X seconds |
| 62 | ... interval for Y minutes and fails if timed out. |
| 63 | ... Default MAX timedout is 10 min, interval 10 seconds. |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 64 | [Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 65 | ... ${interval}=10 sec |
| 66 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 67 | # Description of argument(s): |
| 68 | # max_timeout Maximum time to wait. |
| 69 | # This should be expressed in Robot Framework's time format |
| 70 | # (e.g. "10 minutes"). |
| 71 | # interfal Interval to wait between status checks. |
| 72 | # This should be expressed in Robot Framework's time format |
| 73 | # (e.g. "5 seconds"). |
| 74 | |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 75 | Wait Until Keyword Succeeds |
| 76 | ... ${max_timeout} ${interval} Verify Ping and REST Authentication |
| 77 | |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 78 | |
George Keishing | 06ae4aa | 2016-08-30 01:41:28 -0500 | [diff] [blame] | 79 | Flush REST Sessions |
| 80 | [Documentation] Removes all the active session objects |
| 81 | Delete All Sessions |
George Keishing | b370081 | 2016-08-31 03:03:30 -0500 | [diff] [blame] | 82 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 83 | |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 84 | Trigger Host Watchdog Error |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 85 | [Documentation] Inject host watchdog timeout error via REST. |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 86 | [Arguments] ${milliseconds}=1000 ${sleep_time}=5s |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 87 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 88 | # Description of argument(s): |
| 89 | # milliseconds The time watchdog timer value in milliseconds (e.g. 1000 = |
| 90 | # 1 second). |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 91 | # sleep_time Time delay for host watchdog error to get injected. |
| 92 | # Default is 5 seconds. |
| 93 | |
Michael Walsh | 4ffd1a1 | 2018-03-14 10:35:44 -0500 | [diff] [blame] | 94 | ${data}= Create Dictionary |
| 95 | ... data=xyz.openbmc_project.State.Watchdog.Action.PowerCycle |
| 96 | ${status} ${result}= Run Keyword And Ignore Error |
| 97 | ... Read Attribute ${HOST_WATCHDOG_URI} ExpireAction |
| 98 | Run Keyword If '${status}' == 'PASS' |
| 99 | ... Write Attribute ${HOST_WATCHDOG_URI} ExpireAction data=${data} |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 100 | |
Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 101 | ${int_milliseconds}= Convert To Integer ${milliseconds} |
| 102 | ${data}= Create Dictionary data=${int_milliseconds} |
Michael Walsh | 4ffd1a1 | 2018-03-14 10:35:44 -0500 | [diff] [blame] | 103 | Write Attribute ${HOST_WATCHDOG_URI} Interval data=${data} |
| 104 | |
| 105 | ${data}= Create Dictionary data=${True} |
| 106 | Write Attribute ${HOST_WATCHDOG_URI} Enabled data=${data} |
George Keishing | 37cfa6b | 2017-06-15 10:25:55 -0500 | [diff] [blame] | 107 | |
Rahul Maheshwari | e95622c | 2017-02-24 10:04:29 -0600 | [diff] [blame] | 108 | Sleep ${sleep_time} |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 109 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 110 | |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 111 | Login To OS Host |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 112 | [Documentation] Login to OS Host and return the Login response code. |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 113 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 114 | ... ${os_password}=${OS_PASSWORD} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 115 | |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 116 | # Description of arguments: |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 117 | # ${os_host} IP address of the OS Host. |
| 118 | # ${os_username} OS Host Login user name. |
| 119 | # ${os_password} OS Host Login passwrd. |
| 120 | |
Rahul Maheshwari | d1f45f2 | 2018-10-26 05:16:39 -0500 | [diff] [blame] | 121 | REST Power On stack_mode=skip quiet=1 |
Prashanth Katti | ae7c228 | 2017-03-15 07:43:46 -0500 | [diff] [blame] | 122 | |
George Keishing | 3f223b8 | 2017-06-28 03:50:35 -0500 | [diff] [blame] | 123 | SSHLibrary.Open Connection ${os_host} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 124 | ${resp}= Login ${os_username} ${os_password} |
| 125 | [Return] ${resp} |
Prashanth Katti | 884ee06 | 2017-03-16 05:05:03 -0500 | [diff] [blame] | 126 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 127 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 128 | Initiate Auto Reboot |
| 129 | [Documentation] Initiate an auto reboot. |
| 130 | [Arguments] ${milliseconds}=5000 |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 131 | |
| 132 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 133 | # milliseconds The number of milliseconds for the watchdog timer. |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 134 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 135 | # Set the auto reboot policy. |
| 136 | Set Auto Reboot ${1} |
| 137 | # Set the watchdog timer. |
| 138 | Trigger Host Watchdog Error ${milliseconds} |
| 139 | |
| 140 | |
| 141 | Initiate OS Host Reboot |
| 142 | [Documentation] Initiate an OS reboot. |
| 143 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 144 | ... ${os_password}=${OS_PASSWORD} |
| 145 | |
| 146 | # Description of argument(s): |
| 147 | # os_host The host name or IP address of the OS. |
| 148 | # os_username The username to be used to sign in to the OS. |
| 149 | # os_password The password to be used to sign in to the OS. |
| 150 | |
| 151 | ${cmd_buf}= Run Keyword If '${os_username}' == 'root' |
| 152 | ... Set Variable reboot |
| 153 | ... ELSE |
| 154 | ... Set Variable echo ${os_password} | sudo -S reboot |
| 155 | |
| 156 | ${output} ${stderr} ${rc}= OS Execute Command |
| 157 | ... ${cmd_buf} fork=${1} |
| 158 | |
| 159 | |
| 160 | Initiate OS Host Power Off |
| 161 | [Documentation] Initiate an OS reboot. |
| 162 | [Arguments] ${os_host}=${OS_HOST} ${os_username}=${OS_USERNAME} |
| 163 | ... ${os_password}=${OS_PASSWORD} ${hard}=${0} |
| 164 | |
| 165 | # Description of argument(s): |
| 166 | # os_host The DNS name or IP 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 | # hard Indicates whether to do a hard vs. soft power off. |
| 170 | |
| 171 | ${time_string}= Run Keyword If ${hard} Set Variable ${SPACE}now |
| 172 | ... ELSE Set Variable ${EMPTY} |
| 173 | |
| 174 | ${cmd_buf}= Run Keyword If '${os_username}' == 'root' |
| 175 | ... Set Variable shutdown${time_string} |
| 176 | ... ELSE |
| 177 | ... Set Variable echo ${os_password} | sudo -S shutdown${time_string} |
| 178 | |
| 179 | ${output} ${stderr} ${rc}= OS Execute Command |
| 180 | ... ${cmd_buf} fork=${1} |
Sweta Potthuri | e5a9fc7 | 2017-05-03 07:02:46 -0500 | [diff] [blame] | 181 | |
George Keishing | 3987a1e | 2017-09-20 09:13:02 -0500 | [diff] [blame] | 182 | |
Steven Sombar | 5f3af44 | 2018-02-14 08:30:15 -0600 | [diff] [blame] | 183 | Set System LED State |
| 184 | [Documentation] Set given system LED via REST. |
| 185 | [Arguments] ${led_name} ${led_state} |
| 186 | # Description of argument(s): |
| 187 | # led_name System LED name (e.g. heartbeat, identify, beep). |
| 188 | # led_state LED state to be set (e.g. On, Off). |
| 189 | |
| 190 | ${args}= Create Dictionary |
| 191 | ... data=xyz.openbmc_project.Led.Physical.Action.${led_state} |
| 192 | Write Attribute ${LED_PHYSICAL_URI}${led_name} State data=${args} |
| 193 | |
| 194 | Verify LED State ${led_name} ${led_state} |
| 195 | |
| 196 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 197 | Read Turbo Setting Via REST |
| 198 | [Documentation] Return turbo setting via REST. |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 199 | # Returns 1 if TurboAllowed, 0 if not. |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 200 | |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 201 | ${turbo_setting}= Read Attribute |
| 202 | ... ${CONTROL_HOST_URI}turbo_allowed TurboAllowed |
| 203 | [Return] ${turbo_setting} |
| 204 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 205 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 206 | Set Turbo Setting Via REST |
| 207 | [Documentation] Set turbo setting via REST. |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 208 | [Arguments] ${setting} ${verify}=${False} |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 209 | |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 210 | # Description of argument(s): |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 211 | # setting State to set TurboAllowed, 1=allowed, 0=not allowed. |
| 212 | # verify If True, read the TurboAllowed setting to confirm. |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 213 | |
Steven Sombar | ea79a49 | 2018-04-18 11:14:57 -0500 | [diff] [blame] | 214 | ${data}= Create Dictionary data=${${setting}} |
Steven Sombar | 80bc859 | 2018-04-24 11:44:53 -0500 | [diff] [blame] | 215 | Write Attribute ${CONTROL_HOST_URI}turbo_allowed TurboAllowed |
| 216 | ... verify=${verify} data=${data} |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 217 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 218 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 219 | Set REST Logging Policy |
| 220 | [Documentation] Enable or disable REST logging setting. |
| 221 | [Arguments] ${policy_setting}=${True} |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 222 | |
| 223 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 224 | # policy_setting The policy setting value which can be either |
| 225 | # True or False. |
George Keishing | ef74a8c | 2017-10-20 10:23:52 -0500 | [diff] [blame] | 226 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 227 | ${log_dict}= Create Dictionary data=${policy_setting} |
George Keishing | df3e65f | 2018-12-18 13:06:56 -0600 | [diff] [blame] | 228 | Write Attribute ${BMC_LOGGING_URI}rest_api_logs Enabled |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 229 | ... data=${log_dict} verify=${1} expected_value=${policy_setting} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 230 | |
Steven Sombar | 0acb341 | 2018-01-24 09:38:42 -0600 | [diff] [blame] | 231 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 232 | Old Get Boot Progress |
| 233 | [Documentation] Get the boot progress the old way (via org location). |
| 234 | [Arguments] ${quiet}=${QUIET} |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 235 | |
| 236 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 237 | # quiet Indicates whether this keyword should run without any output to |
| 238 | # the console. |
| 239 | |
| 240 | ${state}= Read Attribute ${OPENBMC_BASE_URI}sensors/host/BootProgress |
| 241 | ... value quiet=${quiet} |
| 242 | |
| 243 | [Return] ${state} |
| 244 | |
| 245 | |
| 246 | Set Boot Progress Method |
| 247 | [Documentation] Set the boot_prog_method to either 'Old' or 'New'. |
| 248 | |
| 249 | # The boot progress data has moved from an 'org' location to an 'xyz' |
| 250 | # location. This keyword will determine whether the new method of getting |
| 251 | # the boot progress is valid and will set the global boot_prog_method |
| 252 | # variable accordingly. If boot_prog_method is already set (either by a |
| 253 | # prior call to this function or via a -v parm), this keyword will simply |
| 254 | # return. |
| 255 | |
| 256 | # Note: There are interim builds that contain boot_progress in both the |
| 257 | # old and the new location values. It is nearly impossible for this |
| 258 | # keyword to determine whether the old boot_progress or the new one is |
| 259 | # active. When using such builds where the old boot_progress is active, |
| 260 | # the only recourse users will have is that they may specify |
| 261 | # -v boot_prog_method:Old to force old behavior on such builds. |
| 262 | |
| 263 | Run Keyword If '${boot_prog_method}' != '${EMPTY}' Return From Keyword |
| 264 | |
| 265 | ${new_status} ${new_value}= Run Keyword And Ignore Error |
| 266 | ... New Get Boot Progress |
| 267 | # If the new style read fails, the method must necessarily be "Old". |
| 268 | Run Keyword If '${new_status}' == 'PASS' |
| 269 | ... Run Keywords |
| 270 | ... Set Global Variable ${boot_prog_method} New AND |
| 271 | ... Rqpvars boot_prog_method AND |
| 272 | ... Return From Keyword |
| 273 | |
| 274 | # Default method is "Old". |
| 275 | Set Global Variable ${boot_prog_method} Old |
| 276 | Rqpvars boot_prog_method |
| 277 | |
| 278 | |
| 279 | Initiate Power On |
| 280 | [Documentation] Initiates the power on and waits until the Is Power On |
| 281 | ... keyword returns that the power state has switched to on. |
| 282 | [Arguments] ${wait}=${1} |
| 283 | |
| 284 | # Description of argument(s): |
| 285 | # wait Indicates whether to wait for a powered on state after issuing |
| 286 | # the power on command. |
| 287 | |
| 288 | @{arglist}= Create List |
| 289 | ${args}= Create Dictionary data=@{arglist} |
| 290 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOn |
| 291 | ... data=${args} |
| 292 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 293 | |
| 294 | # Does caller want to wait for power on status? |
| 295 | Run Keyword If '${wait}' == '${0}' Return From Keyword |
| 296 | Wait Until Keyword Succeeds 3 min 10 sec Is Power On |
| 297 | |
| 298 | |
| 299 | Initiate Power Off |
| 300 | [Documentation] Initiates the power off and waits until the Is Power Off |
| 301 | ... keyword returns that the power state has switched to off. |
| 302 | |
| 303 | @{arglist}= Create List |
| 304 | ${args}= Create Dictionary data=@{arglist} |
| 305 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ powerOff |
| 306 | ... data=${args} |
| 307 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 308 | Wait Until Keyword Succeeds 1 min 10 sec Is Power Off |
| 309 | |
| 310 | |
| 311 | Get Boot Progress |
| 312 | [Documentation] Get the boot progress and return it. |
| 313 | [Arguments] ${quiet}=${QUIET} |
| 314 | |
| 315 | # Description of argument(s): |
| 316 | # quiet Indicates whether this keyword should run without any output to |
| 317 | # the console. |
| 318 | |
| 319 | Set Boot Progress Method |
| 320 | ${state}= Run Keyword If '${boot_prog_method}' == 'New' |
| 321 | ... New Get Boot Progress quiet=${quiet} |
| 322 | ... ELSE |
| 323 | ... Old Get Boot Progress quiet=${quiet} |
| 324 | |
| 325 | [Return] ${state} |
| 326 | |
| 327 | |
| 328 | New Get Boot Progress |
| 329 | [Documentation] Get the boot progress the new way (via xyz location). |
| 330 | [Arguments] ${quiet}=${QUIET} |
| 331 | |
| 332 | # Description of argument(s): |
| 333 | # quiet Indicates whether this keyword should run without any output to |
| 334 | # the console. |
| 335 | |
| 336 | ${state}= Read Attribute ${HOST_STATE_URI} BootProgress quiet=${quiet} |
| 337 | |
| 338 | [Return] ${state.rsplit('.', 1)[1]} |
| 339 | |
| 340 | |
| 341 | New Get Power Policy |
| 342 | [Documentation] Returns the BMC power policy (new method). |
| 343 | ${currentPolicy}= Read Attribute ${POWER_RESTORE_URI} PowerRestorePolicy |
| 344 | |
| 345 | [Return] ${currentPolicy} |
| 346 | |
| 347 | |
| 348 | Old Get Power Policy |
| 349 | [Documentation] Returns the BMC power policy (old method). |
| 350 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 351 | |
| 352 | [Return] ${currentPolicy} |
| 353 | |
| 354 | |
| 355 | Get Auto Reboot |
| 356 | [Documentation] Returns auto reboot setting. |
| 357 | ${setting}= Read Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot |
| 358 | |
| 359 | [Return] ${setting} |
| 360 | |
| 361 | |
| 362 | Trigger Warm Reset |
| 363 | [Documentation] Initiate a warm reset. |
| 364 | |
| 365 | log to console "Triggering warm reset" |
| 366 | ${data}= create dictionary data=@{EMPTY} |
| 367 | ${resp}= openbmc post request |
| 368 | ... ${OPENBMC_BASE_URI}control/bmc0/action/warmReset data=${data} |
| 369 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 370 | ${session_active}= Check If warmReset is Initiated |
| 371 | Run Keyword If '${session_active}' == '${True}' |
| 372 | ... Fail msg=warm reset didn't occur |
| 373 | |
| 374 | Sleep ${SYSTEM_SHUTDOWN_TIME}min |
| 375 | Check If BMC Is Up |
| 376 | |
| 377 | |
| 378 | Get Power State |
| 379 | [Documentation] Returns the power state as an integer. Either 0 or 1. |
| 380 | [Arguments] ${quiet}=${QUIET} |
| 381 | |
| 382 | # Description of argument(s): |
| 383 | # quiet Indicates whether this keyword should run without any output to |
| 384 | # the console. |
| 385 | |
| 386 | @{arglist}= Create List |
| 387 | ${args}= Create Dictionary data=@{arglist} |
| 388 | |
| 389 | ${resp}= Call Method ${OPENBMC_BASE_URI}control/chassis0/ getPowerState |
| 390 | ... data=${args} quiet=${quiet} |
| 391 | Should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 392 | ${content}= to json ${resp.content} |
| 393 | |
| 394 | [Return] ${content["data"]} |
| 395 | |
| 396 | |
| 397 | Clear BMC Gard Record |
| 398 | [Documentation] Clear gard records from the system. |
| 399 | |
| 400 | @{arglist}= Create List |
| 401 | ${args}= Create Dictionary data=@{arglist} |
| 402 | ${resp}= Call Method |
| 403 | ... ${OPENPOWER_CONTROL}gard Reset data=${args} |
| 404 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 405 | |
| 406 | |
| 407 | Flash PNOR |
| 408 | [Documentation] Calls flash bios update method to flash PNOR image |
| 409 | [Arguments] ${pnor_image} |
| 410 | |
| 411 | # Description of argument(s): |
| 412 | # pnor_image The filename and path of the PNOR image |
| 413 | # (e.g. "/home/image/zaius.pnor"). |
| 414 | |
| 415 | @{arglist}= Create List ${pnor_image} |
| 416 | ${args}= Create Dictionary data=@{arglist} |
| 417 | ${resp}= Call Method /org/openbmc/control/flash/bios/ update |
| 418 | ... data=${args} |
| 419 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 420 | Wait Until Keyword Succeeds 2 min 10 sec Is PNOR Flashing |
| 421 | |
| 422 | |
| 423 | Get Flash BIOS Status |
| 424 | [Documentation] Returns the status of the flash BIOS API as a string. For |
| 425 | ... example 'Flashing', 'Flash Done', etc |
| 426 | ${data}= Read Properties /org/openbmc/control/flash/bios |
| 427 | [Return] ${data['status']} |
| 428 | |
| 429 | |
| 430 | Is PNOR Flashing |
| 431 | [Documentation] Get BIOS 'Flashing' status. This indicates that PNOR |
| 432 | ... flashing has started. |
| 433 | ${status}= Get Flash BIOS Status |
| 434 | Should Contain ${status} Flashing |
| 435 | |
| 436 | |
| 437 | Is PNOR Flash Done |
| 438 | [Documentation] Get BIOS 'Flash Done' status. This indicates that the |
| 439 | ... PNOR flashing has completed. |
| 440 | ${status}= Get Flash BIOS Status |
| 441 | should be equal as strings ${status} Flash Done |
| 442 | |
| 443 | |
| 444 | Create OS Console File Path |
| 445 | [Documentation] Create OS console file path name and return it. |
| 446 | [Arguments] ${log_file_path}=${EMPTY} |
| 447 | |
| 448 | # Description of arguments: |
| 449 | # file_path The caller's candidate value. If this value is ${EMPTY}, this |
| 450 | # keyword will compose a file path name. Otherwise, this |
| 451 | # keyword will use the caller's file_path value. In either |
| 452 | # case, the value will be returned. |
| 453 | |
| 454 | ${status}= Run Keyword And Return Status Variable Should Exist |
| 455 | ... ${TEST_NAME} |
| 456 | |
| 457 | ${default_file_path}= Set Variable If ${status} == ${TRUE} |
| 458 | ... /tmp/${OPENBMC_HOST}_${TEST_NAME.replace(' ', '')}_os_console.txt |
| 459 | ... /tmp/${OPENBMC_HOST}_os_console.txt |
| 460 | |
| 461 | ${log_file_path}= Set Variable If '${log_file_path}' == '${EMPTY}' |
| 462 | ... ${default_file_path} ${log_file_path} |
| 463 | |
| 464 | [Return] ${log_file_path} |
| 465 | |
| 466 | |
| 467 | Get Endpoint Paths |
| 468 | [Documentation] Returns all url paths ending with given endpoint |
| 469 | ... Example: |
| 470 | ... Given the following endpoint: cpu |
| 471 | ... This keyword will return: list of all urls ending with |
| 472 | ... cpu - |
| 473 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu0, |
| 474 | ... /org/openbmc/inventory/system/chassis/motherboard/cpu1 |
| 475 | [Arguments] ${path} ${endpoint} |
| 476 | |
| 477 | # Description of arguments: |
| 478 | # path URL path for enumeration. |
| 479 | # endpoint Endpoint string (url path ending). |
| 480 | |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 481 | # Make sure path ends with slash. |
| 482 | ${path}= Add Trailing Slash ${path} |
| 483 | |
| 484 | ${resp}= Read Properties ${path}enumerate timeout=30 |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 485 | Log Dictionary ${resp} |
| 486 | |
| 487 | ${list}= Get Dictionary Keys ${resp} |
| 488 | # For a given string, look for prefix and suffix for matching expression. |
| 489 | # Start of string followed by zero or more of any character followed by |
| 490 | # any digit or lower case character. |
| 491 | ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${endpoint}\[0-9a-z]*$ |
| 492 | |
| 493 | [Return] ${resp} |
| 494 | |
| 495 | |
| 496 | Set BMC Power Policy |
| 497 | [Documentation] Set the given BMC power policy. |
| 498 | [Arguments] ${policy} |
| 499 | |
| 500 | # Note that this function will translate the old style "RESTORE_LAST_STATE" |
| 501 | # policy to the new style "xyz.openbmc_project.Control.Power.RestorePolicy. |
| 502 | # Policy.Restore" for you. |
| 503 | |
| 504 | # Description of argument(s): |
| 505 | # policy Power restore policy (e.g "RESTORE_LAST_STATE", |
| 506 | # ${RESTORE_LAST_STATE}). |
| 507 | |
| 508 | # Set the bmc_power_policy_method to either 'Old' or 'New'. |
| 509 | Set Power Policy Method |
| 510 | # This translation helps bridge between old and new method for calling. |
| 511 | ${policy}= Translate Power Policy Value ${policy} |
| 512 | # Run the appropriate keyword. |
| 513 | Run Key ${bmc_power_policy_method} Set Power Policy \ ${policy} |
| 514 | ${currentPolicy}= Get System Power Policy |
| 515 | Should Be Equal ${currentPolicy} ${policy} |
| 516 | |
| 517 | |
| 518 | Delete Error Logs |
| 519 | [Documentation] Delete error logs. |
| 520 | |
| 521 | # Check if error logs entries exist, if not return. |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 522 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}list quiet=${1} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 523 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 524 | |
| 525 | # Get the list of error logs entries and delete them all. |
| 526 | ${elog_entries}= Get URL List ${BMC_LOGGING_ENTRY} |
| 527 | :FOR ${entry} IN @{elog_entries} |
| 528 | \ Delete Error Log Entry ${entry} |
| 529 | |
| 530 | |
| 531 | Delete All Error Logs |
| 532 | [Documentation] Delete all error log entries using "DeleteAll" interface. |
| 533 | |
| 534 | ${data}= Create Dictionary data=@{EMPTY} |
| 535 | ${resp}= Openbmc Post Request ${BMC_LOGGING_URI}action/DeleteAll |
| 536 | ... data=${data} |
| 537 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 538 | |
| 539 | |
| 540 | Get Elog URL List |
| 541 | [Documentation] Return error log entry list of URLs. |
| 542 | |
| 543 | ${url_list}= Read Properties /xyz/openbmc_project/logging/entry/ |
| 544 | Sort List ${url_list} |
| 545 | [Return] ${url_list} |
| 546 | |
| 547 | |
| 548 | Get BMC Flash Chip Boot Side |
| 549 | [Documentation] Return the BMC flash chip boot side. |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 550 | |
| 551 | # Example: |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 552 | # 0 - indicates chip select is current side. |
| 553 | # 32 - indicates chip select is alternate side. |
George Keishing | 034902d | 2017-11-10 13:15:38 -0600 | [diff] [blame] | 554 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 555 | ${boot_side} ${stderr} ${rc}= BMC Execute Command |
| 556 | ... cat /sys/class/watchdog/watchdog1/bootstatus |
| 557 | |
| 558 | [Return] ${boot_side} |
| 559 | |
| 560 | |
| 561 | Update Root Password |
| 562 | [Documentation] Update system "root" user password. |
| 563 | [Arguments] ${openbmc_password}=${OPENBMC_PASSWORD} |
| 564 | |
| 565 | # Description of argument(s): |
| 566 | # openbmc_password The root password for the open BMC system. |
| 567 | |
| 568 | @{password}= Create List ${openbmc_password} |
| 569 | ${data}= Create Dictionary data=@{password} |
| 570 | |
Sridevi Ramesh | eadeef0 | 2019-01-17 08:56:18 -0600 | [diff] [blame] | 571 | ${headers}= Create Dictionary Content-Type=application/json X-Auth-Token=${XAUTH_TOKEN} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 572 | ${resp}= Post Request openbmc ${BMC_USER_URI}root/action/SetPassword |
| 573 | ... data=${data} headers=${headers} |
| 574 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 575 | ... msg=Updating the new root password failed, RC=${resp.status_code}. |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 576 | |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 577 | |
Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 578 | Watchdog Object Should Exist |
| 579 | [Documentation] Check that watchdog object exists. |
| 580 | |
| 581 | ${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0 |
| 582 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 583 | ... msg=Expected watchdog object does not exist. |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 584 | |
| 585 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 586 | Get System LED State |
| 587 | [Documentation] Return the state of given system LED. |
| 588 | [Arguments] ${led_name} |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 589 | |
| 590 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 591 | # led_name System LED name (e.g. heartbeat, identify, beep). |
Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 592 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 593 | ${state}= Read Attribute ${LED_PHYSICAL_URI}${led_name} State |
| 594 | [Return] ${state.rsplit('.', 1)[1]} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 595 | |
| 596 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 597 | Verify LED State |
| 598 | [Documentation] Checks if LED is in given state. |
| 599 | [Arguments] ${led_name} ${led_state} |
| 600 | # Description of argument(s): |
| 601 | # led_name System LED name (e.g. heartbeat, identify, beep). |
| 602 | # led_state LED state to be verified (e.g. On, Off). |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 603 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 604 | ${state}= Get System LED State ${led_name} |
| 605 | Should Be Equal ${state} ${led_state} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 606 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 607 | |
| 608 | Get LED State XYZ |
| 609 | [Documentation] Returns state of given LED. |
| 610 | [Arguments] ${led_name} |
| 611 | |
| 612 | # Description of argument(s): |
| 613 | # led_name Name of LED. |
| 614 | |
| 615 | ${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted |
| 616 | # Returns the state of the LED, either On or Off. |
| 617 | [Return] ${state} |
George Keishing | b9f407b | 2018-02-20 00:07:46 -0600 | [diff] [blame] | 618 | |
George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 619 | |
| 620 | Verify Identify LED State |
| 621 | [Documentation] Verify the identify LED state |
| 622 | ... matches caller's expectations. |
| 623 | [Arguments] ${expected_state} |
| 624 | |
| 625 | # Description of argument(s): |
| 626 | # expected_state The LED state expected by the caller ("Blink" or "Off"). |
| 627 | |
| 628 | ${resp}= Read Attribute ${LED_PHYSICAL_URI}/front_id State |
| 629 | Should Be Equal ${resp} |
| 630 | ... xyz.openbmc_project.Led.Physical.Action.${expected_state} |
| 631 | ... msg=Unexpected LED state. |
| 632 | |
| 633 | ${resp}= Read Attribute ${LED_PHYSICAL_URI}/rear_id State |
| 634 | Should Be Equal ${resp} |
| 635 | ... xyz.openbmc_project.Led.Physical.Action.${expected_state} |
| 636 | ... msg=Unexpected LED state. |
| 637 | |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 638 | |
| 639 | Verify The Attribute |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 640 | [Documentation] Verify the given attribute. |
Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 641 | [Arguments] ${uri} ${attribute_name} ${attribute_value} |
| 642 | |
| 643 | # Description of argument(s): |
| 644 | # uri URI path |
| 645 | # (e.g. "/xyz/openbmc_project/control/host0/TPMEnable"). |
| 646 | # attribute_name Name of attribute to be verified (e.g. "TPMEnable"). |
| 647 | # attribute_value The expected value of attribute (e.g. "1", "0", etc.) |
| 648 | |
| 649 | ${output}= Read Attribute ${uri} ${attribute_name} |
| 650 | Should Be Equal ${attribute_value} ${output} |
| 651 | ... msg=Attribute "${attribute_name} does not have the expected value. |
George Keishing | cf0d777 | 2018-05-04 08:22:50 -0500 | [diff] [blame] | 652 | |
| 653 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 654 | New Set Power Policy |
| 655 | [Documentation] Set the given BMC power policy (new method). |
| 656 | [Arguments] ${policy} |
George Keishing | b4adfc7 | 2018-10-26 09:39:32 -0500 | [diff] [blame] | 657 | |
| 658 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 659 | # policy Power restore policy (e.g. ${ALWAYS_POWER_OFF}). |
George Keishing | c5fef58 | 2018-07-18 08:41:28 -0500 | [diff] [blame] | 660 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 661 | ${valueDict}= Create Dictionary data=${policy} |
| 662 | Write Attribute |
| 663 | ... ${POWER_RESTORE_URI} PowerRestorePolicy data=${valueDict} |
George Keishing | 216e584 | 2018-08-31 14:58:15 -0500 | [diff] [blame] | 664 | |
| 665 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 666 | Old Set Power Policy |
| 667 | [Documentation] Set the given BMC power policy (old method). |
| 668 | [Arguments] ${policy} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 669 | |
| 670 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 671 | # policy Power restore policy (e.g. "ALWAYS_POWER_OFF"). |
| 672 | |
| 673 | ${valueDict}= create dictionary data=${policy} |
| 674 | Write Attribute ${HOST_SETTING} power_policy data=${valueDict} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 675 | |
| 676 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 677 | Set Auto Reboot |
| 678 | [Documentation] Set the given auto reboot setting. |
| 679 | [Arguments] ${setting} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 680 | |
| 681 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 682 | # setting The reboot setting, 1 for enabling and 0 for disabling. |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 683 | |
Sridevi Ramesh | 68d72ff | 2019-02-04 09:24:46 -0600 | [diff] [blame] | 684 | ${valueDict}= Convert To Integer ${setting} |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 685 | ${data}= Create Dictionary data=${valueDict} |
| 686 | Write Attribute ${CONTROL_HOST_URI}/auto_reboot AutoReboot data=${data} |
| 687 | ${current_setting}= Get Auto Reboot |
| 688 | Should Be Equal As Integers ${current_setting} ${setting} |
George Keishing | 3c004dc | 2018-10-10 07:16:47 -0500 | [diff] [blame] | 689 | |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 690 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 691 | Set Control Boot Mode |
| 692 | [Documentation] Set given boot mode on the boot object path attribute. |
| 693 | [Arguments] ${boot_path} ${boot_mode} |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 694 | |
| 695 | # Description of argument(s): |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 696 | # boot_path Boot object path. |
| 697 | # Example: |
| 698 | # /xyz/openbmc_project/control/host0/boot |
| 699 | # /xyz/openbmc_project/control/host0/boot/one_time |
| 700 | # boot_mode Boot mode which need to be set. |
| 701 | # Example: |
| 702 | # "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular" |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 703 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 704 | ${valueDict}= Create Dictionary data=${boot_mode} |
| 705 | Write Attribute ${boot_path} BootMode data=${valueDict} |
George Keishing | c25c55d | 2018-10-30 02:23:44 -0500 | [diff] [blame] | 706 | |
Steven Sombar | f60cbcf | 2018-12-07 08:12:18 -0600 | [diff] [blame] | 707 | |
| 708 | Is Power On |
| 709 | [Documentation] Verify that the BMC chassis state is on. |
| 710 | ${state}= Get Power State |
| 711 | Should be equal ${state} ${1} |
| 712 | |
| 713 | |
| 714 | Is Power Off |
| 715 | [Documentation] Verify that the BMC chassis state is off. |
| 716 | ${state}= Get Power State |
| 717 | Should be equal ${state} ${0} |