blob: f3625108c26d48531153abf63a185b28299653ed [file] [log] [blame]
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "Power" sub-menu of "Resource Management".
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05006
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -05007Suite Setup Suite Setup Execution
Nandish-Mattib8b82c52023-02-28 05:42:05 -06008Suite Teardown Suite Teardown Execution
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05009
10
11*** Variables ***
12
sarandev366c4be22023-03-07 06:56:51 -060013${xpath_power_heading} //h1[text()="Power"]
14${xpath_power_ops_checkbox} //*[@data-test-id='power-checkbox-togglePowerCapField']
15${xpath_cap_input_button} //*[@data-test-id='power-input-powerCap']
16${xpath_submit_button} //*[@data-test-id='power-button-savePowerCapValue']
17${xpath_select_static} //input[@value='Static']
18${xpath_select_powersaving} //input[@value='PowerSaving']
19${xpath_select_maximum_performance} //input[@value='MaximumPerformance']
20${xpath_update_power_save_mode} //button[contains(text(),'Update power saver mode')]
21${xpath_page_loading_progress_bar} //*[@aria-label='Page loading progress bar']
22${xpath_idle_power_saver_checkbox} //*[@data-test-id='power-checkbox-toggleIdlePower']
23${xpath_to_enter_delay_time} //*[@data-test-id='power-input-enterDwellTimeSeconds']
24${xpath_to_enter_utilization_threshold} //*[@data-test-id='power-input-enterUtilizationPercent']
25${xpath_to_exit_delay_time} //*[@data-test-id='power-input-exitDwellTimeSeconds']
26${xpath_to_exit_utilization_threshold} //*[@data-test-id='power-input-exitUtilizationPercent']
27${xpath_update_idle_power_saver_button} //button[contains(text(),'Update idle power saver')]
28${xpath_reset_to_default_button} //button[contains(text(),'Reset to default')]
Nandish-Mattib8b82c52023-02-28 05:42:05 -060029
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050030*** Test Cases ***
31
Rahul Maheshwari142642d2021-08-24 00:00:15 -050032Verify Navigation To Power Page
33 [Documentation] Verify navigation to power page.
34 [Tags] Verify_Navigation_To_Power_Page
Rahul Maheshwari317c7102020-08-30 21:10:22 -050035
Rahul Maheshwari142642d2021-08-24 00:00:15 -050036 Page Should Contain Element ${xpath_power_heading}
sarandev366c4be22023-03-07 06:56:51 -060037 Click Element ${xpath_overview_menu}
38 Click Element ${xpath_power_link}
39 Location Should Contain power
40 Page Should Contain Element ${xpath_power_heading}
Rahul Maheshwari317c7102020-08-30 21:10:22 -050041
42
Rahul Maheshwari142642d2021-08-24 00:00:15 -050043Verify Existence Of All Sections In Power Page
44 [Documentation] Verify existence of all sections in power page.
45 [Tags] Verify_Existence_Of_All_Sections_In_Power_Page
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050046
47 Page Should Contain Current power consumption
48 Page Should Contain Power cap setting
49 Page Should Contain Power cap value
rramyasr-inc279ff12022-08-05 04:10:59 -050050 Page Should Contain Power and performance mode
51 Page Should Contain Idle power saver
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050052
Nandish-Mattib8b82c52023-02-28 05:42:05 -060053
Rahul Maheshwari142642d2021-08-24 00:00:15 -050054Verify Existence Of All Buttons In Power Page
55 [Documentation] Verify existence of all buttons in power page.
56 [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page
manashsarmaa7aed482021-07-20 07:14:33 -050057
58 Page Should Contain Element ${xpath_power_ops_checkbox}
59 Page Should Contain Element ${xpath_cap_input_button}
60 Page Should Contain Element ${xpath_submit_button}
rramyasr-ine0a45682022-09-19 11:38:49 -050061 Page Should Contain Element ${xpath_select_static}
62 Page Should Contain Element ${xpath_select_powersaving}
63 Page Should Contain Element ${xpath_select_maximum_performance}
64 Page Should Contain Element ${xpath_update_power_save_mode}
sarandev366c4be22023-03-07 06:56:51 -060065 Page Should Contain Element ${xpath_idle_power_saver_checkbox}
66 Page Should Contain Element ${xpath_to_enter_delay_time}
67 Page Should Contain Element ${xpath_to_enter_utilization_threshold}
68 Page Should Contain Element ${xpath_to_exit_delay_time}
69 Page Should Contain Element ${xpath_to_exit_utilization_threshold}
70 Page Should Contain Element ${xpath_update_idle_power_saver_button}
71 Page Should Contain Element ${xpath_reset_to_default_button}
manashsarmaa7aed482021-07-20 07:14:33 -050072
73
manashsarma6ffdbf42020-11-10 03:32:19 -060074Verify Server Power Cap Setting Is On
75 [Documentation] Verify server power cap setting is on.
76 [Tags] Verify_Server_Power_Cap_Setting_Is_On
77 [Setup] Save Initial Power Cap State
78 [Teardown] Restore Initial Power Cap State
79
80 Run Keyword If '${checkbox_initial_state}' == 'False'
81 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
82
83 # Now input a cap value and submit.
84 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
rramyasr-in5b8a4e92022-10-31 06:07:18 -050085
86 # Get maximum and minimum values of power cap.
87 ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics
88
89 ${power_cap_value}= Evaluate
90 ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']})
91 ... modules=random
92
93 Input Text ${xpath_cap_input_button} ${power_cap_value}
manashsarma6ffdbf42020-11-10 03:32:19 -060094 Click Element ${xpath_submit_button}
rramyasr-in5b8a4e92022-10-31 06:07:18 -050095 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value}
Nandish-Mattib8b82c52023-02-28 05:42:05 -060096 Wait Until Element Is Visible ${xpath_success_message} timeout=60
97 Wait Until Element Is Not Visible ${xpath_success_message} timeout=60
manashsarma6ffdbf42020-11-10 03:32:19 -060098
99
rramyasr-ina05d4162023-02-21 01:18:23 -0600100Verify Server Power Cap Setting With Power Cap Disabled
101 [Documentation] Verify that valid server power cap value can be set
102 ... in GUI with power cap is in disabled state.
George Keishing2382d9e2023-02-23 11:32:32 -0600103 [Tags] Verify_Server_Power_Cap_Setting_With_Power_Cap_Disabled
rramyasr-ina05d4162023-02-21 01:18:23 -0600104 [Setup] Save Initial Power Cap State
105 [Teardown] Restore Initial Power Cap State
manashsarma44ca5762020-11-10 05:48:14 -0600106
rramyasr-ina05d4162023-02-21 01:18:23 -0600107 Run Keyword If '${checkbox_initial_state}' == 'True'
108 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
manashsarma44ca5762020-11-10 05:48:14 -0600109
rramyasr-ina05d4162023-02-21 01:18:23 -0600110 # Now input a cap value and submit.
manashsarma44ca5762020-11-10 05:48:14 -0600111 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
manashsarma44ca5762020-11-10 05:48:14 -0600112
rramyasr-ina05d4162023-02-21 01:18:23 -0600113 # Get maximum and minimum values of power cap.
114 ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics
manashsarma44ca5762020-11-10 05:48:14 -0600115
rramyasr-ina05d4162023-02-21 01:18:23 -0600116 ${power_cap_value}= Evaluate
117 ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']})
118 ... modules=random
119
120 Input Text ${xpath_cap_input_button} ${power_cap_value}
manashsarma44ca5762020-11-10 05:48:14 -0600121 Click Element ${xpath_submit_button}
rramyasr-ina05d4162023-02-21 01:18:23 -0600122 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value}
Nandish-Mattib8b82c52023-02-28 05:42:05 -0600123 Wait Until Element Is Visible ${xpath_success_message} timeout=60
124 Wait Until Element Is Not Visible ${xpath_success_message} timeout=60
manashsarma44ca5762020-11-10 05:48:14 -0600125
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500126*** Keywords ***
127
manashsarma6ffdbf42020-11-10 03:32:19 -0600128Is Power Cap Value Set
129 [Documentation] Check if power cap value is set to the given value.
130 [Arguments] ${expected_value}
131
132 ${cap}= Get Power Cap Value
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500133 Should Be Equal ${cap} ${expected_value}
manashsarma6ffdbf42020-11-10 03:32:19 -0600134
135
136Save Initial Power Cap State
137 [Documentation] Save the initial power cap state.
138
139 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
140 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
141 Set Suite Variable ${checkbox_initial_state} ${status}
142
143
144Restore Initial Power Cap State
145 [Documentation] Restore the initial power cap state.
146
147 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
148 Run Keyword If ${status} != ${checkbox_initial_state}
149 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
150
151
152Get Power Cap Value
153 [Documentation] Return the power cap value.
154
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500155 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/EnvironmentMetrics
manashsarma6ffdbf42020-11-10 03:32:19 -0600156
157 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
158 # format so with additional steps in consequent steps string is converted to json formatted
159 # so that a json object can be formed.
160 #
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500161 # "Id": "EnvironmentMetrics",
162 # "Name": "Chassis Environment Metrics",
163 # "PowerLimitWatts": {
164 # "AllowableMax": 2488,
165 # "AllowableMin": 1778,
166 # "ControlMode": "Disabled",
167 # "SetPoint": 2400,
manashsarma6ffdbf42020-11-10 03:32:19 -0600168
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500169
170 [return] ${redfish_power['PowerLimitWatts']['SetPoint']}
manashsarma6ffdbf42020-11-10 03:32:19 -0600171
172
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500173Suite Setup Execution
174 [Documentation] Do suite setup tasks.
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500175
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500176 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500177 Click Element ${xpath_resource_management_menu}
178 Click Element ${xpath_power_sub_menu}
179 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power
rramyasr-ind1597f02022-08-08 02:34:49 -0500180 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Nandish-Mattib8b82c52023-02-28 05:42:05 -0600181 Redfish.Login
182
183Suite Teardown Execution
184 [Documentation] Do suite teardown tasks.
185
186 Logout GUI
187 Close Browser
188 Redfish.Logout