Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 3 | Documentation Test OpenBMC GUI "Power" sub-menu of "Resource Management". |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 4 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 5 | Resource ../../lib/gui_resource.robot |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 6 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 7 | Suite Setup Suite Setup Execution |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 8 | Suite Teardown Suite Teardown Execution |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 9 | |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
sarandev3 | 66c4be2 | 2023-03-07 06:56:51 -0600 | [diff] [blame] | 13 | ${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-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 29 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 30 | *** Test Cases *** |
| 31 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 32 | Verify Navigation To Power Page |
| 33 | [Documentation] Verify navigation to power page. |
| 34 | [Tags] Verify_Navigation_To_Power_Page |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 35 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 36 | Page Should Contain Element ${xpath_power_heading} |
sarandev3 | 66c4be2 | 2023-03-07 06:56:51 -0600 | [diff] [blame] | 37 | 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 Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 41 | |
| 42 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 43 | Verify 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 Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 46 | |
| 47 | Page Should Contain Current power consumption |
| 48 | Page Should Contain Power cap setting |
| 49 | Page Should Contain Power cap value |
rramyasr-in | c279ff1 | 2022-08-05 04:10:59 -0500 | [diff] [blame] | 50 | Page Should Contain Power and performance mode |
| 51 | Page Should Contain Idle power saver |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 52 | |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 53 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 54 | Verify 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 |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 57 | |
| 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-in | e0a4568 | 2022-09-19 11:38:49 -0500 | [diff] [blame] | 61 | 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} |
sarandev3 | 66c4be2 | 2023-03-07 06:56:51 -0600 | [diff] [blame] | 65 | 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} |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 72 | |
| 73 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 74 | Verify 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-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 85 | |
| 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} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 94 | Click Element ${xpath_submit_button} |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 95 | Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value} |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 96 | Wait Until Element Is Visible ${xpath_success_message} timeout=60 |
| 97 | Wait Until Element Is Not Visible ${xpath_success_message} timeout=60 |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 98 | |
| 99 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 100 | Verify 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 Keishing | 2382d9e | 2023-02-23 11:32:32 -0600 | [diff] [blame] | 103 | [Tags] Verify_Server_Power_Cap_Setting_With_Power_Cap_Disabled |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 104 | [Setup] Save Initial Power Cap State |
| 105 | [Teardown] Restore Initial Power Cap State |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 106 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 107 | Run Keyword If '${checkbox_initial_state}' == 'True' |
| 108 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 109 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 110 | # Now input a cap value and submit. |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 111 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 112 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 113 | # Get maximum and minimum values of power cap. |
| 114 | ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 115 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 116 | ${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} |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 121 | Click Element ${xpath_submit_button} |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 122 | Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value} |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 123 | Wait Until Element Is Visible ${xpath_success_message} timeout=60 |
| 124 | Wait Until Element Is Not Visible ${xpath_success_message} timeout=60 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 125 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 126 | *** Keywords *** |
| 127 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 128 | Is 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-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 133 | Should Be Equal ${cap} ${expected_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 134 | |
| 135 | |
| 136 | Save 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 | |
| 144 | Restore 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 | |
| 152 | Get Power Cap Value |
| 153 | [Documentation] Return the power cap value. |
| 154 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 155 | ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/EnvironmentMetrics |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 156 | |
| 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-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 161 | # "Id": "EnvironmentMetrics", |
| 162 | # "Name": "Chassis Environment Metrics", |
| 163 | # "PowerLimitWatts": { |
| 164 | # "AllowableMax": 2488, |
| 165 | # "AllowableMin": 1778, |
| 166 | # "ControlMode": "Disabled", |
| 167 | # "SetPoint": 2400, |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 168 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 169 | |
| 170 | [return] ${redfish_power['PowerLimitWatts']['SetPoint']} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 171 | |
| 172 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 173 | Suite Setup Execution |
| 174 | [Documentation] Do suite setup tasks. |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 175 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 176 | Launch Browser And Login GUI |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 177 | 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-in | d1597f0 | 2022-08-08 02:34:49 -0500 | [diff] [blame] | 180 | Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 181 | Redfish.Login |
| 182 | |
| 183 | Suite Teardown Execution |
| 184 | [Documentation] Do suite teardown tasks. |
| 185 | |
| 186 | Logout GUI |
| 187 | Close Browser |
| 188 | Redfish.Logout |