| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 1 | *** Settings *** | 
| George Keishing | 4583a08 | 2019-02-25 10:28:42 -0600 | [diff] [blame] | 2 | Documentation    This suite tests Redfish Host power operations. | 
 | 3 |  | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 4 | Resource         ../../lib/boot_utils.robot | 
| George Keishing | 36c39aa | 2019-03-01 04:33:58 -0600 | [diff] [blame] | 5 | Resource         ../../lib/common_utils.robot | 
| George Keishing | d8c8b31 | 2019-04-09 11:34:58 -0500 | [diff] [blame] | 6 | Resource         ../../lib/open_power_utils.robot | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 7 |  | 
| George Keishing | 36c39aa | 2019-03-01 04:33:58 -0600 | [diff] [blame] | 8 | Test Setup       Test Setup Execution | 
 | 9 | Test Teardown    Test Teardown Execution | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 10 |  | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 11 | *** Variables *** | 
 | 12 |  | 
 | 13 | # Extended code to check OCC state, power metric and others. | 
| George Keishing | af9da9e | 2022-11-11 10:48:28 -0600 | [diff] [blame] | 14 | ${additional_power_check}      ${0} | 
 | 15 | ${additional_occ_check}        ${0} | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 16 |  | 
| George Keishing | 15f94d2 | 2022-10-10 08:15:24 -0500 | [diff] [blame] | 17 | # By default disable SOL logging collection. | 
 | 18 | ${capture_sol}                 ${0} | 
 | 19 |  | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 20 | *** Test Cases *** | 
 | 21 |  | 
| George Keishing | 4583a08 | 2019-02-25 10:28:42 -0600 | [diff] [blame] | 22 | Verify Redfish Host GracefulShutdown | 
 | 23 |     [Documentation]  Verify Redfish host graceful shutdown operation. | 
 | 24 |     [Tags]  Verify_Redfish_Host_GracefulShutdown | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 25 |  | 
 | 26 |     Redfish Power Off | 
 | 27 |  | 
| George Keishing | 9833f96 | 2019-10-07 12:37:57 -0500 | [diff] [blame] | 28 |  | 
| Lei YU | 46b1a8e | 2020-01-16 14:21:53 +0800 | [diff] [blame] | 29 | Verify Redfish BMC PowerOn With OCC State | 
 | 30 |     [Documentation]  Verify Redfish host power on operation. | 
 | 31 |     [Tags]  Verify_Redfish_BMC_PowerOn_With_OCC_State | 
 | 32 |  | 
 | 33 |     Redfish Power On | 
 | 34 |  | 
 | 35 |     # TODO: Replace OCC state check with redfish property when available. | 
 | 36 |     Verify OCC State | 
 | 37 |  | 
 | 38 |  | 
| George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 39 | Verify Redfish Host PowerOn | 
| George Keishing | 4583a08 | 2019-02-25 10:28:42 -0600 | [diff] [blame] | 40 |     [Documentation]  Verify Redfish host power on operation. | 
 | 41 |     [Tags]  Verify_Redfish_Host_PowerOn | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 42 |  | 
 | 43 |     Redfish Power On | 
 | 44 |  | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 45 |     IF  ${additional_occ_check} == ${1} | 
 | 46 |         Wait Until Keyword Succeeds  3 mins  30 secs  Match OCC And CPU State Count | 
 | 47 |     END | 
| George Keishing | d918148 | 2021-10-08 08:13:22 -0500 | [diff] [blame] | 48 |  | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 49 |     IF  ${additional_power_check} == ${1}  Power Check | 
| George Keishing | 9833f96 | 2019-10-07 12:37:57 -0500 | [diff] [blame] | 50 |  | 
 | 51 |  | 
| George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 52 | Verify Redfish Host GracefulRestart | 
| George Keishing | 4583a08 | 2019-02-25 10:28:42 -0600 | [diff] [blame] | 53 |     [Documentation]  Verify Redfish host graceful restart operation. | 
 | 54 |     [Tags]  Verify_Redfish_Host_GracefulRestart | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 55 |  | 
| George Keishing | e523fc0 | 2020-03-23 12:28:01 -0500 | [diff] [blame] | 56 |     RF SYS GracefulRestart | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 57 |  | 
| George Keishing | 9833f96 | 2019-10-07 12:37:57 -0500 | [diff] [blame] | 58 |  | 
| George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 59 | Verify Redfish Host PowerOff | 
| George Keishing | 4583a08 | 2019-02-25 10:28:42 -0600 | [diff] [blame] | 60 |     [Documentation]  Verify Redfish host power off operation. | 
 | 61 |     [Tags]  Verify_Redfish_Host_PowerOff | 
| Sridevi Ramesh | d737eb9 | 2019-02-13 05:03:21 -0600 | [diff] [blame] | 62 |  | 
 | 63 |     Redfish Hard Power Off | 
| George Keishing | 36c39aa | 2019-03-01 04:33:58 -0600 | [diff] [blame] | 64 |  | 
 | 65 | *** Keywords *** | 
 | 66 |  | 
 | 67 | Test Setup Execution | 
 | 68 |     [Documentation]  Do test case setup tasks. | 
 | 69 |  | 
| George Keishing | 9833f96 | 2019-10-07 12:37:57 -0500 | [diff] [blame] | 70 |     Printn | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 71 |     IF  ${capture_sol} == ${1}  Start SOL Console Logging | 
| George Keishing | 2997a28 | 2020-06-16 00:42:08 -0500 | [diff] [blame] | 72 |     Redfish.Login | 
| George Keishing | 36c39aa | 2019-03-01 04:33:58 -0600 | [diff] [blame] | 73 |  | 
 | 74 |  | 
 | 75 | Test Teardown Execution | 
 | 76 |     [Documentation]  Collect FFDC and SOL log. | 
 | 77 |  | 
 | 78 |     FFDC On Test Case Fail | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 79 |     IF  ${capture_sol} == ${1}  Stop SOL Capture | 
| George Keishing | 99a6205 | 2020-06-12 13:32:13 -0500 | [diff] [blame] | 80 |  | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 81 |     IF  ${REDFISH_SUPPORTED} | 
 | 82 |         Redfish Set Auto Reboot  RetryAttempts | 
 | 83 |     ELSE | 
 | 84 |        Set Auto Reboot  ${1} | 
 | 85 |     END | 
 | 86 |  | 
| George Keishing | 2997a28 | 2020-06-16 00:42:08 -0500 | [diff] [blame] | 87 |     Redfish.Logout | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 88 |  | 
 | 89 |  | 
| George Keishing | 15f94d2 | 2022-10-10 08:15:24 -0500 | [diff] [blame] | 90 | Stop SOL Capture | 
 | 91 |     [Documentation]  Stop SOL log collection. | 
 | 92 |  | 
 | 93 |     ${sol_log}=    Stop SOL Console Logging | 
 | 94 |     Log   ${sol_log} | 
 | 95 |  | 
 | 96 |  | 
| George Keishing | d918148 | 2021-10-08 08:13:22 -0500 | [diff] [blame] | 97 | Power Check | 
 | 98 |     [Documentation]  Verify PowerConsumedWatts property. | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 99 |  | 
 | 100 |     ${power_uri_list}=  redfish_utils.Get Members URI  /redfish/v1/Chassis/  PowerControl | 
 | 101 |     Log List  ${power_uri_list} | 
 | 102 |  | 
 | 103 |     # Power entries could be seen across different redfish path, remove the URI | 
 | 104 |     # where the attribute is non-existent. | 
 | 105 |     # Example: | 
 | 106 |     #     ['/redfish/v1/Chassis/chassis/Power', | 
 | 107 |     #      '/redfish/v1/Chassis/motherboard/Power'] | 
 | 108 |     FOR  ${idx}  IN  @{power_uri_list} | 
 | 109 |         ${power_control}=  redfish_utils.Get Attribute  ${idx}  PowerControl | 
 | 110 |         Log Dictionary  ${power_control[0]} | 
 | 111 |  | 
 | 112 |         # Ensure the path does have the attribute else set to EMPTY as default to skip. | 
 | 113 |         ${value}=  Get Variable Value  ${power_control[0]['PowerConsumedWatts']}  ${EMPTY} | 
| Sridevi Ramesh | 49c1b53 | 2025-05-09 04:32:43 -0500 | [diff] [blame] | 114 |         IF  "${value}" == "${EMPTY}" | 
 | 115 |             Remove Values From List  ${power_uri_list}  ${idx} | 
 | 116 |         END | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 117 |  | 
 | 118 |         # Check the next available element in the list. | 
| Sridevi Ramesh | ac15572 | 2025-05-02 05:09:40 -0500 | [diff] [blame] | 119 |         IF  "${value}" == "${EMPTY}"  CONTINUE | 
| George Keishing | f688800 | 2020-09-29 09:12:21 -0500 | [diff] [blame] | 120 |  | 
 | 121 |         Valid Dict  power_control[${0}]  ['PowerConsumedWatts'] | 
 | 122 |  | 
 | 123 |     END | 
 | 124 |  | 
 | 125 |     # Double check, the validation has at least one valid path. | 
 | 126 |     Should Not Be Empty  ${power_uri_list} | 
 | 127 |     ...  msg=Should contain at least one element in the list. |