blob: 3cbcbc1e2018bb188f6901edaab6ea23b8fd8dae [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
George Keishingf6888002020-09-29 09:12:21 -050011*** Variables ***
12
13# Extended code to check OCC state, power metric and others.
14${additional_power_check} ${1}
George Keishing40905032021-11-09 12:45:33 -060015${additional_occ_check} ${1}
George Keishingf6888002020-09-29 09:12:21 -050016
Sridevi Rameshd737eb92019-02-13 05:03:21 -060017*** Test Cases ***
18
George Keishing4583a082019-02-25 10:28:42 -060019Verify Redfish Host GracefulShutdown
20 [Documentation] Verify Redfish host graceful shutdown operation.
21 [Tags] Verify_Redfish_Host_GracefulShutdown
Sridevi Rameshd737eb92019-02-13 05:03:21 -060022
23 Redfish Power Off
24
George Keishing9833f962019-10-07 12:37:57 -050025
Lei YU46b1a8e2020-01-16 14:21:53 +080026Verify Redfish BMC PowerOn With OCC State
27 [Documentation] Verify Redfish host power on operation.
28 [Tags] Verify_Redfish_BMC_PowerOn_With_OCC_State
29
30 Redfish Power On
31
32 # TODO: Replace OCC state check with redfish property when available.
33 Verify OCC State
34
35
Sridevi Rameshd737eb92019-02-13 05:03:21 -060036Verify Redfish BMC PowerOn
George Keishing4583a082019-02-25 10:28:42 -060037 [Documentation] Verify Redfish host power on operation.
38 [Tags] Verify_Redfish_Host_PowerOn
Sridevi Rameshd737eb92019-02-13 05:03:21 -060039
40 Redfish Power On
41
George Keishing40905032021-11-09 12:45:33 -060042 Run Keyword If ${additional_occ_check} == ${1}
George Keishingd9181482021-10-08 08:13:22 -050043 ... Wait Until Keyword Succeeds 3 mins 30 secs Match OCC And CPU State Count
44
45 Run Keyword If ${additional_power_check} == ${1} Power Check
George Keishing9833f962019-10-07 12:37:57 -050046
47
Sridevi Rameshd737eb92019-02-13 05:03:21 -060048Verify Redfish BMC GracefulRestart
George Keishing4583a082019-02-25 10:28:42 -060049 [Documentation] Verify Redfish host graceful restart operation.
50 [Tags] Verify_Redfish_Host_GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060051
George Keishinge523fc02020-03-23 12:28:01 -050052 RF SYS GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060053
George Keishing9833f962019-10-07 12:37:57 -050054
Sridevi Rameshd737eb92019-02-13 05:03:21 -060055Verify Redfish BMC PowerOff
George Keishing4583a082019-02-25 10:28:42 -060056 [Documentation] Verify Redfish host power off operation.
57 [Tags] Verify_Redfish_Host_PowerOff
Sridevi Rameshd737eb92019-02-13 05:03:21 -060058
59 Redfish Hard Power Off
George Keishing36c39aa2019-03-01 04:33:58 -060060
61*** Keywords ***
62
63Test Setup Execution
64 [Documentation] Do test case setup tasks.
65
George Keishing9833f962019-10-07 12:37:57 -050066 Printn
George Keishing36c39aa2019-03-01 04:33:58 -060067 Start SOL Console Logging
George Keishing2997a282020-06-16 00:42:08 -050068 Redfish.Login
George Keishing36c39aa2019-03-01 04:33:58 -060069
70
71Test Teardown Execution
72 [Documentation] Collect FFDC and SOL log.
73
74 FFDC On Test Case Fail
75 ${sol_log}= Stop SOL Console Logging
76 Log ${sol_log}
George Keishing99a62052020-06-12 13:32:13 -050077
78 Run Keyword If ${REDFISH_SUPPORTED}
79 ... Redfish Set Auto Reboot RetryAttempts
80 ... ELSE
81 ... Set Auto Reboot ${1}
George Keishing2997a282020-06-16 00:42:08 -050082 Redfish.Logout
George Keishingf6888002020-09-29 09:12:21 -050083
84
George Keishingd9181482021-10-08 08:13:22 -050085Power Check
86 [Documentation] Verify PowerConsumedWatts property.
George Keishingf6888002020-09-29 09:12:21 -050087
88 ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl
89 Log List ${power_uri_list}
90
91 # Power entries could be seen across different redfish path, remove the URI
92 # where the attribute is non-existent.
93 # Example:
94 # ['/redfish/v1/Chassis/chassis/Power',
95 # '/redfish/v1/Chassis/motherboard/Power']
96 FOR ${idx} IN @{power_uri_list}
97 ${power_control}= redfish_utils.Get Attribute ${idx} PowerControl
98 Log Dictionary ${power_control[0]}
99
100 # Ensure the path does have the attribute else set to EMPTY as default to skip.
101 ${value}= Get Variable Value ${power_control[0]['PowerConsumedWatts']} ${EMPTY}
102 Run Keyword If "${value}" == "${EMPTY}"
103 ... Remove Values From List ${power_uri_list} ${idx}
104
105 # Check the next available element in the list.
106 Continue For Loop If "${value}" == "${EMPTY}"
107
108 Valid Dict power_control[${0}] ['PowerConsumedWatts']
109
110 END
111
112 # Double check, the validation has at least one valid path.
113 Should Not Be Empty ${power_uri_list}
114 ... msg=Should contain at least one element in the list.