blob: 31c1438937f3522740977ff24f44453f8e91cc2b [file] [log] [blame]
Sridevi Rameshd737eb92019-02-13 05:03:21 -06001*** Settings ***
George Keishing4583a082019-02-25 10:28:42 -06002Documentation This suite tests Redfish Host power operations.
3
Sridevi Rameshd737eb92019-02-13 05:03:21 -06004Resource ../../lib/boot_utils.robot
George Keishing36c39aa2019-03-01 04:33:58 -06005Resource ../../lib/common_utils.robot
George Keishingd8c8b312019-04-09 11:34:58 -05006Resource ../../lib/open_power_utils.robot
Sridevi Rameshd737eb92019-02-13 05:03:21 -06007
George Keishing36c39aa2019-03-01 04:33:58 -06008Test Setup Test Setup Execution
9Test Teardown Test Teardown Execution
Sridevi Rameshd737eb92019-02-13 05:03:21 -060010
Igor Kanyukafeb79d62025-10-20 21:24:03 +010011Test Tags Power_Operations
12
George Keishingf6888002020-09-29 09:12:21 -050013*** Variables ***
14
15# Extended code to check OCC state, power metric and others.
George Keishingaf9da9e2022-11-11 10:48:28 -060016${additional_power_check} ${0}
17${additional_occ_check} ${0}
George Keishingf6888002020-09-29 09:12:21 -050018
George Keishing15f94d22022-10-10 08:15:24 -050019# By default disable SOL logging collection.
20${capture_sol} ${0}
21
Sridevi Rameshd737eb92019-02-13 05:03:21 -060022*** Test Cases ***
23
George Keishing4583a082019-02-25 10:28:42 -060024Verify Redfish Host GracefulShutdown
25 [Documentation] Verify Redfish host graceful shutdown operation.
26 [Tags] Verify_Redfish_Host_GracefulShutdown
Sridevi Rameshd737eb92019-02-13 05:03:21 -060027
28 Redfish Power Off
29
George Keishing9833f962019-10-07 12:37:57 -050030
Lei YU46b1a8e2020-01-16 14:21:53 +080031Verify 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 Keishing5236ec52022-01-31 12:07:58 -060041Verify Redfish Host PowerOn
George Keishing4583a082019-02-25 10:28:42 -060042 [Documentation] Verify Redfish host power on operation.
43 [Tags] Verify_Redfish_Host_PowerOn
Sridevi Rameshd737eb92019-02-13 05:03:21 -060044
45 Redfish Power On
46
Sridevi Ramesh49c1b532025-05-09 04:32:43 -050047 IF ${additional_occ_check} == ${1}
48 Wait Until Keyword Succeeds 3 mins 30 secs Match OCC And CPU State Count
49 END
George Keishingd9181482021-10-08 08:13:22 -050050
Sridevi Ramesh49c1b532025-05-09 04:32:43 -050051 IF ${additional_power_check} == ${1} Power Check
George Keishing9833f962019-10-07 12:37:57 -050052
53
George Keishing5236ec52022-01-31 12:07:58 -060054Verify Redfish Host GracefulRestart
George Keishing4583a082019-02-25 10:28:42 -060055 [Documentation] Verify Redfish host graceful restart operation.
56 [Tags] Verify_Redfish_Host_GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060057
George Keishinge523fc02020-03-23 12:28:01 -050058 RF SYS GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060059
George Keishing9833f962019-10-07 12:37:57 -050060
George Keishing5236ec52022-01-31 12:07:58 -060061Verify Redfish Host PowerOff
George Keishing4583a082019-02-25 10:28:42 -060062 [Documentation] Verify Redfish host power off operation.
63 [Tags] Verify_Redfish_Host_PowerOff
Sridevi Rameshd737eb92019-02-13 05:03:21 -060064
65 Redfish Hard Power Off
George Keishing36c39aa2019-03-01 04:33:58 -060066
67*** Keywords ***
68
69Test Setup Execution
70 [Documentation] Do test case setup tasks.
71
George Keishing9833f962019-10-07 12:37:57 -050072 Printn
Sridevi Ramesh49c1b532025-05-09 04:32:43 -050073 IF ${capture_sol} == ${1} Start SOL Console Logging
George Keishing2997a282020-06-16 00:42:08 -050074 Redfish.Login
George Keishing36c39aa2019-03-01 04:33:58 -060075
76
77Test Teardown Execution
78 [Documentation] Collect FFDC and SOL log.
79
80 FFDC On Test Case Fail
Sridevi Ramesh49c1b532025-05-09 04:32:43 -050081 IF ${capture_sol} == ${1} Stop SOL Capture
George Keishing99a62052020-06-12 13:32:13 -050082
Sridevi Ramesh49c1b532025-05-09 04:32:43 -050083 IF ${REDFISH_SUPPORTED}
84 Redfish Set Auto Reboot RetryAttempts
85 ELSE
86 Set Auto Reboot ${1}
87 END
88
George Keishing2997a282020-06-16 00:42:08 -050089 Redfish.Logout
George Keishingf6888002020-09-29 09:12:21 -050090
91
George Keishing15f94d22022-10-10 08:15:24 -050092Stop SOL Capture
93 [Documentation] Stop SOL log collection.
94
95 ${sol_log}= Stop SOL Console Logging
96 Log ${sol_log}
97
98
George Keishingd9181482021-10-08 08:13:22 -050099Power Check
100 [Documentation] Verify PowerConsumedWatts property.
George Keishingf6888002020-09-29 09:12:21 -0500101
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 Ramesh49c1b532025-05-09 04:32:43 -0500116 IF "${value}" == "${EMPTY}"
117 Remove Values From List ${power_uri_list} ${idx}
118 END
George Keishingf6888002020-09-29 09:12:21 -0500119
120 # Check the next available element in the list.
Sridevi Rameshac155722025-05-02 05:09:40 -0500121 IF "${value}" == "${EMPTY}" CONTINUE
George Keishingf6888002020-09-29 09:12:21 -0500122
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.