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