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 | |
rramyasr-in | c279ff1 | 2022-08-05 04:10:59 -0500 | [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'] |
rramyasr-in | d1597f0 | 2022-08-08 02:34:49 -0500 | [diff] [blame] | 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'] |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 22 | |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 23 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 24 | *** Test Cases *** |
| 25 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 26 | Verify Navigation To Power Page |
| 27 | [Documentation] Verify navigation to power page. |
| 28 | [Tags] Verify_Navigation_To_Power_Page |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 29 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 30 | Page Should Contain Element ${xpath_power_heading} |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 31 | |
| 32 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 33 | Verify Existence Of All Sections In Power Page |
| 34 | [Documentation] Verify existence of all sections in power page. |
| 35 | [Tags] Verify_Existence_Of_All_Sections_In_Power_Page |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 36 | |
| 37 | Page Should Contain Current power consumption |
| 38 | Page Should Contain Power cap setting |
| 39 | Page Should Contain Power cap value |
rramyasr-in | c279ff1 | 2022-08-05 04:10:59 -0500 | [diff] [blame] | 40 | Page Should Contain Power and performance mode |
| 41 | Page Should Contain Idle power saver |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 42 | |
Nandish-Matti | b8b82c5 | 2023-02-28 05:42:05 -0600 | [diff] [blame] | 43 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 44 | Verify Existence Of All Buttons In Power Page |
| 45 | [Documentation] Verify existence of all buttons in power page. |
| 46 | [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 47 | |
| 48 | Page Should Contain Element ${xpath_power_ops_checkbox} |
| 49 | Page Should Contain Element ${xpath_cap_input_button} |
| 50 | Page Should Contain Element ${xpath_submit_button} |
rramyasr-in | e0a4568 | 2022-09-19 11:38:49 -0500 | [diff] [blame] | 51 | Page Should Contain Element ${xpath_select_static} |
| 52 | Page Should Contain Element ${xpath_select_powersaving} |
| 53 | Page Should Contain Element ${xpath_select_maximum_performance} |
| 54 | Page Should Contain Element ${xpath_update_power_save_mode} |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 55 | |
| 56 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 57 | Verify Server Power Cap Setting Is On |
| 58 | [Documentation] Verify server power cap setting is on. |
| 59 | [Tags] Verify_Server_Power_Cap_Setting_Is_On |
| 60 | [Setup] Save Initial Power Cap State |
| 61 | [Teardown] Restore Initial Power Cap State |
| 62 | |
| 63 | Run Keyword If '${checkbox_initial_state}' == 'False' |
| 64 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 65 | |
| 66 | # Now input a cap value and submit. |
| 67 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 68 | |
| 69 | # Get maximum and minimum values of power cap. |
| 70 | ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics |
| 71 | |
| 72 | ${power_cap_value}= Evaluate |
| 73 | ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']}) |
| 74 | ... modules=random |
| 75 | |
| 76 | Input Text ${xpath_cap_input_button} ${power_cap_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 77 | Click Element ${xpath_submit_button} |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 78 | 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] | 79 | Wait Until Element Is Visible ${xpath_success_message} timeout=60 |
| 80 | Wait Until Element Is Not Visible ${xpath_success_message} timeout=60 |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 81 | |
| 82 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 83 | Verify Server Power Cap Setting With Power Cap Disabled |
| 84 | [Documentation] Verify that valid server power cap value can be set |
| 85 | ... in GUI with power cap is in disabled state. |
George Keishing | 2382d9e | 2023-02-23 11:32:32 -0600 | [diff] [blame] | 86 | [Tags] Verify_Server_Power_Cap_Setting_With_Power_Cap_Disabled |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 87 | [Setup] Save Initial Power Cap State |
| 88 | [Teardown] Restore Initial Power Cap State |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 89 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 90 | Run Keyword If '${checkbox_initial_state}' == 'True' |
| 91 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 92 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 93 | # Now input a cap value and submit. |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 94 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 95 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 96 | # Get maximum and minimum values of power cap. |
| 97 | ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 98 | |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 99 | ${power_cap_value}= Evaluate |
| 100 | ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']}) |
| 101 | ... modules=random |
| 102 | |
| 103 | Input Text ${xpath_cap_input_button} ${power_cap_value} |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 104 | Click Element ${xpath_submit_button} |
rramyasr-in | a05d416 | 2023-02-21 01:18:23 -0600 | [diff] [blame] | 105 | 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] | 106 | Wait Until Element Is Visible ${xpath_success_message} timeout=60 |
| 107 | Wait Until Element Is Not Visible ${xpath_success_message} timeout=60 |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 108 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 109 | *** Keywords *** |
| 110 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 111 | Is Power Cap Value Set |
| 112 | [Documentation] Check if power cap value is set to the given value. |
| 113 | [Arguments] ${expected_value} |
| 114 | |
| 115 | ${cap}= Get Power Cap Value |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 116 | Should Be Equal ${cap} ${expected_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 117 | |
| 118 | |
| 119 | Save Initial Power Cap State |
| 120 | [Documentation] Save the initial power cap state. |
| 121 | |
| 122 | Wait Until Page Contains Element ${xpath_power_ops_checkbox} |
| 123 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 124 | Set Suite Variable ${checkbox_initial_state} ${status} |
| 125 | |
| 126 | |
| 127 | Restore Initial Power Cap State |
| 128 | [Documentation] Restore the initial power cap state. |
| 129 | |
| 130 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 131 | Run Keyword If ${status} != ${checkbox_initial_state} |
| 132 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 133 | |
| 134 | |
| 135 | Get Power Cap Value |
| 136 | [Documentation] Return the power cap value. |
| 137 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 138 | ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/EnvironmentMetrics |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 139 | |
| 140 | # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json |
| 141 | # format so with additional steps in consequent steps string is converted to json formatted |
| 142 | # so that a json object can be formed. |
| 143 | # |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 144 | # "Id": "EnvironmentMetrics", |
| 145 | # "Name": "Chassis Environment Metrics", |
| 146 | # "PowerLimitWatts": { |
| 147 | # "AllowableMax": 2488, |
| 148 | # "AllowableMin": 1778, |
| 149 | # "ControlMode": "Disabled", |
| 150 | # "SetPoint": 2400, |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 151 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 152 | |
| 153 | [return] ${redfish_power['PowerLimitWatts']['SetPoint']} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 154 | |
| 155 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 156 | Suite Setup Execution |
| 157 | [Documentation] Do suite setup tasks. |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 158 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 159 | Launch Browser And Login GUI |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 160 | Click Element ${xpath_resource_management_menu} |
| 161 | Click Element ${xpath_power_sub_menu} |
| 162 | Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power |
rramyasr-in | d1597f0 | 2022-08-08 02:34:49 -0500 | [diff] [blame] | 163 | 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] | 164 | Redfish.Login |
| 165 | |
| 166 | Suite Teardown Execution |
| 167 | [Documentation] Do suite teardown tasks. |
| 168 | |
| 169 | Logout GUI |
| 170 | Close Browser |
| 171 | Redfish.Logout |