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