blob: c415d3696412119e48394cdb91dc11e28d7a7cc7 [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
George Keishing15f94d22022-10-10 08:15:24 -050017# By default disable SOL logging collection.
18${capture_sol} ${0}
19
Sridevi Rameshd737eb92019-02-13 05:03:21 -060020*** Test Cases ***
21
George Keishing4583a082019-02-25 10:28:42 -060022Verify Redfish Host GracefulShutdown
23 [Documentation] Verify Redfish host graceful shutdown operation.
24 [Tags] Verify_Redfish_Host_GracefulShutdown
Sridevi Rameshd737eb92019-02-13 05:03:21 -060025
26 Redfish Power Off
27
George Keishing9833f962019-10-07 12:37:57 -050028
Lei YU46b1a8e2020-01-16 14:21:53 +080029Verify 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 Keishing5236ec52022-01-31 12:07:58 -060039Verify Redfish Host PowerOn
George Keishing4583a082019-02-25 10:28:42 -060040 [Documentation] Verify Redfish host power on operation.
41 [Tags] Verify_Redfish_Host_PowerOn
Sridevi Rameshd737eb92019-02-13 05:03:21 -060042
43 Redfish Power On
44
George Keishing40905032021-11-09 12:45:33 -060045 Run Keyword If ${additional_occ_check} == ${1}
George Keishingd9181482021-10-08 08:13:22 -050046 ... Wait Until Keyword Succeeds 3 mins 30 secs Match OCC And CPU State Count
47
48 Run Keyword If ${additional_power_check} == ${1} Power Check
George Keishing9833f962019-10-07 12:37:57 -050049
50
George Keishing5236ec52022-01-31 12:07:58 -060051Verify Redfish Host GracefulRestart
George Keishing4583a082019-02-25 10:28:42 -060052 [Documentation] Verify Redfish host graceful restart operation.
53 [Tags] Verify_Redfish_Host_GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060054
George Keishinge523fc02020-03-23 12:28:01 -050055 RF SYS GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060056
George Keishing9833f962019-10-07 12:37:57 -050057
George Keishing5236ec52022-01-31 12:07:58 -060058Verify Redfish Host PowerOff
George Keishing4583a082019-02-25 10:28:42 -060059 [Documentation] Verify Redfish host power off operation.
60 [Tags] Verify_Redfish_Host_PowerOff
Sridevi Rameshd737eb92019-02-13 05:03:21 -060061
62 Redfish Hard Power Off
George Keishing36c39aa2019-03-01 04:33:58 -060063
64*** Keywords ***
65
66Test Setup Execution
67 [Documentation] Do test case setup tasks.
68
George Keishing9833f962019-10-07 12:37:57 -050069 Printn
George Keishing15f94d22022-10-10 08:15:24 -050070 Run Keyword If ${capture_sol} == ${1} Start SOL Console Logging
George Keishing2997a282020-06-16 00:42:08 -050071 Redfish.Login
George Keishing36c39aa2019-03-01 04:33:58 -060072
73
74Test Teardown Execution
75 [Documentation] Collect FFDC and SOL log.
76
77 FFDC On Test Case Fail
George Keishing15f94d22022-10-10 08:15:24 -050078 Run Keyword If ${capture_sol} == ${1} Stop SOL Capture
George Keishing99a62052020-06-12 13:32:13 -050079
80 Run Keyword If ${REDFISH_SUPPORTED}
81 ... Redfish Set Auto Reboot RetryAttempts
82 ... ELSE
83 ... Set Auto Reboot ${1}
George Keishing2997a282020-06-16 00:42:08 -050084 Redfish.Logout
George Keishingf6888002020-09-29 09:12:21 -050085
86
George Keishing15f94d22022-10-10 08:15:24 -050087Stop SOL Capture
88 [Documentation] Stop SOL log collection.
89
90 ${sol_log}= Stop SOL Console Logging
91 Log ${sol_log}
92
93
George Keishingd9181482021-10-08 08:13:22 -050094Power Check
95 [Documentation] Verify PowerConsumedWatts property.
George Keishingf6888002020-09-29 09:12:21 -050096
97 ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl
98 Log List ${power_uri_list}
99
100 # Power entries could be seen across different redfish path, remove the URI
101 # where the attribute is non-existent.
102 # Example:
103 # ['/redfish/v1/Chassis/chassis/Power',
104 # '/redfish/v1/Chassis/motherboard/Power']
105 FOR ${idx} IN @{power_uri_list}
106 ${power_control}= redfish_utils.Get Attribute ${idx} PowerControl
107 Log Dictionary ${power_control[0]}
108
109 # Ensure the path does have the attribute else set to EMPTY as default to skip.
110 ${value}= Get Variable Value ${power_control[0]['PowerConsumedWatts']} ${EMPTY}
111 Run Keyword If "${value}" == "${EMPTY}"
112 ... Remove Values From List ${power_uri_list} ${idx}
113
114 # Check the next available element in the list.
115 Continue For Loop If "${value}" == "${EMPTY}"
116
117 Valid Dict power_control[${0}] ['PowerConsumedWatts']
118
119 END
120
121 # Double check, the validation has at least one valid path.
122 Should Not Be Empty ${power_uri_list}
123 ... msg=Should contain at least one element in the list.