blob: 563f24efb0a5bb1fcafc5c02fbb006118a25258a [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}
15
Sridevi Rameshd737eb92019-02-13 05:03:21 -060016*** Test Cases ***
17
George Keishing4583a082019-02-25 10:28:42 -060018Verify Redfish Host GracefulShutdown
19 [Documentation] Verify Redfish host graceful shutdown operation.
20 [Tags] Verify_Redfish_Host_GracefulShutdown
Sridevi Rameshd737eb92019-02-13 05:03:21 -060021
22 Redfish Power Off
23
George Keishing9833f962019-10-07 12:37:57 -050024
Lei YU46b1a8e2020-01-16 14:21:53 +080025Verify Redfish BMC PowerOn With OCC State
26 [Documentation] Verify Redfish host power on operation.
27 [Tags] Verify_Redfish_BMC_PowerOn_With_OCC_State
28
29 Redfish Power On
30
31 # TODO: Replace OCC state check with redfish property when available.
32 Verify OCC State
33
34
Sridevi Rameshd737eb92019-02-13 05:03:21 -060035Verify Redfish BMC PowerOn
George Keishing4583a082019-02-25 10:28:42 -060036 [Documentation] Verify Redfish host power on operation.
37 [Tags] Verify_Redfish_Host_PowerOn
Sridevi Rameshd737eb92019-02-13 05:03:21 -060038
39 Redfish Power On
40
George Keishingf6888002020-09-29 09:12:21 -050041 Run Keyword If ${additional_power_check} == ${1} Additional OCC And Power Check
George Keishing9833f962019-10-07 12:37:57 -050042
43
Sridevi Rameshd737eb92019-02-13 05:03:21 -060044Verify Redfish BMC GracefulRestart
George Keishing4583a082019-02-25 10:28:42 -060045 [Documentation] Verify Redfish host graceful restart operation.
46 [Tags] Verify_Redfish_Host_GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060047
George Keishinge523fc02020-03-23 12:28:01 -050048 RF SYS GracefulRestart
Sridevi Rameshd737eb92019-02-13 05:03:21 -060049
George Keishing9833f962019-10-07 12:37:57 -050050
Sridevi Rameshd737eb92019-02-13 05:03:21 -060051Verify Redfish BMC PowerOff
George Keishing4583a082019-02-25 10:28:42 -060052 [Documentation] Verify Redfish host power off operation.
53 [Tags] Verify_Redfish_Host_PowerOff
Sridevi Rameshd737eb92019-02-13 05:03:21 -060054
55 Redfish Hard Power Off
George Keishing36c39aa2019-03-01 04:33:58 -060056
57*** Keywords ***
58
59Test Setup Execution
60 [Documentation] Do test case setup tasks.
61
George Keishing9833f962019-10-07 12:37:57 -050062 Printn
George Keishing36c39aa2019-03-01 04:33:58 -060063 Start SOL Console Logging
George Keishing2997a282020-06-16 00:42:08 -050064 Redfish.Login
George Keishing36c39aa2019-03-01 04:33:58 -060065
66
67Test Teardown Execution
68 [Documentation] Collect FFDC and SOL log.
69
70 FFDC On Test Case Fail
71 ${sol_log}= Stop SOL Console Logging
72 Log ${sol_log}
George Keishing99a62052020-06-12 13:32:13 -050073
74 Run Keyword If ${REDFISH_SUPPORTED}
75 ... Redfish Set Auto Reboot RetryAttempts
76 ... ELSE
77 ... Set Auto Reboot ${1}
George Keishing2997a282020-06-16 00:42:08 -050078 Redfish.Logout
George Keishingf6888002020-09-29 09:12:21 -050079
80
81Additional OCC And Power Check
82 [Documentation] Verify OCC state and PowerConsumedWatts property.
83
84 # TODO: Replace OCC state check with redfish property when available.
85 Verify OCC State
86
87 ${power_uri_list}= redfish_utils.Get Members URI /redfish/v1/Chassis/ PowerControl
88 Log List ${power_uri_list}
89
90 # Power entries could be seen across different redfish path, remove the URI
91 # where the attribute is non-existent.
92 # Example:
93 # ['/redfish/v1/Chassis/chassis/Power',
94 # '/redfish/v1/Chassis/motherboard/Power']
95 FOR ${idx} IN @{power_uri_list}
96 ${power_control}= redfish_utils.Get Attribute ${idx} PowerControl
97 Log Dictionary ${power_control[0]}
98
99 # Ensure the path does have the attribute else set to EMPTY as default to skip.
100 ${value}= Get Variable Value ${power_control[0]['PowerConsumedWatts']} ${EMPTY}
101 Run Keyword If "${value}" == "${EMPTY}"
102 ... Remove Values From List ${power_uri_list} ${idx}
103
104 # Check the next available element in the list.
105 Continue For Loop If "${value}" == "${EMPTY}"
106
107 Valid Dict power_control[${0}] ['PowerConsumedWatts']
108
109 END
110
111 # Double check, the validation has at least one valid path.
112 Should Not Be Empty ${power_uri_list}
113 ... msg=Should contain at least one element in the list.