Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This is a resource file of OpenBMC ASMI It contains the |
| 3 | ... user-defined keywords which are available to all gui modules |
| 4 | |
| 5 | Library String |
| 6 | Library Collections |
| 7 | Library DateTime |
| 8 | Library XvfbRobot |
| 9 | Library OperatingSystem |
| 10 | Library Selenium2Library 120 120 |
| 11 | Library AngularJSLibrary |
| 12 | Library SSHLibrary 30 Seconds |
| 13 | Library Process |
| 14 | Library supporting_libs.py |
| 15 | Library ../../../lib/gen_print.py |
| 16 | Library ../../../lib/gen_robot_print.py |
| 17 | Library ../../../lib/gen_valid.py |
| 18 | Library ../../../lib/gen_robot_ssh.py |
| 19 | Library ../../../lib/bmc_ssh_utils.py |
| 20 | Resource ../../../lib/resource.txt |
| 21 | Resource ../../../lib/rest_client.robot |
| 22 | Resource ../../../lib/state_manager.robot |
| 23 | Variables ../data/resource_variables.py |
| 24 | |
| 25 | *** Variables *** |
Sivas SRR | c70e9ae | 2018-02-14 23:53:49 -0600 | [diff] [blame] | 26 | ${obmc_gui_url} https://${OPENBMC_HOST} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 27 | # Default Browser. |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 28 | ${default_browser} ff |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 29 | |
| 30 | ${obmc_PowerOff_state} Off |
| 31 | ${obmc_PowerRunning_state} Running |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 32 | ${obmc_PowerStandby_state} Standby |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 33 | |
| 34 | *** Keywords *** |
| 35 | Launch OpenBMC GUI Browser |
| 36 | [Documentation] Launch the OpenBMC GUI URL on a browser. |
| 37 | # By default uses headless mode, otherwise, the GUI browser. |
| 38 | |
| 39 | ${op_system}= Get Operating System |
| 40 | Run Keyword If '${op_system}' == 'windows' |
| 41 | ... Launch Browser in Windows Platform |
| 42 | ... ELSE |
| 43 | ... Launch Headless Browser |
| 44 | |
| 45 | Get Operating System |
| 46 | [Documentation] Identify platform/OS. |
| 47 | |
| 48 | ${curdir_lower_case}= Convert To Lowercase ${CURDIR} |
| 49 | ${windows_platform}= Run Keyword And Return Status |
| 50 | ... Should Contain ${curdir_lower_case} c:\ |
| 51 | ${op_system}= Run Keyword If '${windows_platform}' == 'True' |
| 52 | ... Set Variable windows |
| 53 | ... ELSE |
| 54 | ... Set Variable linux |
| 55 | [Return] ${op_system} |
| 56 | |
| 57 | Launch Browser in Windows Platform |
| 58 | [Documentation] Open the browser with the URL and |
| 59 | ... login on windows platform. |
| 60 | |
Sivas SRR | c70e9ae | 2018-02-14 23:53:49 -0600 | [diff] [blame] | 61 | ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${default_browser} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 62 | Maximize Browser Window |
| 63 | Set Global Variable ${BROWSER_ID} |
| 64 | |
| 65 | Launch Headless Browser |
| 66 | [Documentation] Launch headless browser. |
| 67 | |
| 68 | Start Virtual Display 1920 1080 |
Sivas SRR | c70e9ae | 2018-02-14 23:53:49 -0600 | [diff] [blame] | 69 | ${BROWSER_ID}= Open Browser ${obmc_gui_url} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 70 | Set Global Variable ${BROWSER_ID} |
| 71 | Set Window Size 1920 1080 |
| 72 | |
| 73 | Login OpenBMC GUI |
| 74 | [Documentation] Perform login to open BMC GUI. |
| 75 | [Arguments] ${username}=${OPENBMC_USERNAME} |
| 76 | ... ${password}=${OPENBMC_PASSWORD} |
| 77 | # Description of argument(s): |
| 78 | # username The username. |
| 79 | # password The password. |
| 80 | |
Sivas SRR | c70e9ae | 2018-02-14 23:53:49 -0600 | [diff] [blame] | 81 | Go To ${obmc_gui_url} |
Sivas SRR | a692535 | 2018-02-19 08:59:03 -0600 | [diff] [blame] | 82 | Wait Until Element Is Enabled ${xpath_textbox_hostname} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 83 | Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST} |
| 84 | Input Text ${xpath_textbox_username} ${username} |
| 85 | Input Password ${xpath_textbox_password} ${password} |
Sivas SRR | ffa4269 | 2018-01-17 05:17:35 -0600 | [diff] [blame] | 86 | Click Element login__submit |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 87 | Wait Until Element Is Enabled ${xpath_button_logout} |
Sivas SRR | ffa4269 | 2018-01-17 05:17:35 -0600 | [diff] [blame] | 88 | Page Should Contain Server information |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 89 | |
| 90 | |
| 91 | Test Setup Execution |
| 92 | [Documentation] Verify all the preconditions to be tested. |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 93 | [Arguments] ${obmc_test_setup_state}=${OBMC_PowerOff_state} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 94 | # Description of argument(s): |
| 95 | # obmc_test_setup The OpenBMC required state. |
| 96 | |
| 97 | Rprint Timen ${TEST NAME} ==> [STARTED] |
| 98 | Login OpenBMC GUI |
| 99 | Log To Console Verifying the system state and stablity... |
| 100 | ${obmc_current_state}= Get Text ${xpath_display_server_power_status} |
| 101 | Rpvars obmc_current_state |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 102 | |
| 103 | ${obmc_state_status}= Run Keyword And Return Status |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 104 | ... Should Contain ${obmc_current_state} ${obmc_test_setup_state} |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 105 | Return From Keyword If '${obmc_state_status}' == 'True' |
| 106 | |
| 107 | ${obmc_standby_state}= Run Keyword And Return Status |
| 108 | ... Should Contain ${obmc_current_state} ${obmc_standby_state} |
| 109 | |
| 110 | Run Keyword If '${obmc_standby_state}' == 'True' |
| 111 | ... Reboot OpenBMC |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 112 | Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}' |
| 113 | ... Power On OpenBMC |
| 114 | Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}' |
| 115 | ... Power Off OpenBMC |
| 116 | |
| 117 | Power Off OpenBMC |
| 118 | [Documentation] Power off the OBMC system. |
| 119 | |
| 120 | Log To Console Power Off OpenBMC... |
| 121 | Click Element ${xpath_display_server_power_status} |
| 122 | Execute JavaScript window.scrollTo(0, document.body.scrollHeight) |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 123 | Click Button ${xpath_select_button_orderly_shutdown} |
| 124 | Click Yes Button ${xpath_select_button_orderly_shutdown_yes} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 125 | Wait OpenBMC To Become Stable ${obmc_off_state} |
| 126 | |
| 127 | Power On OpenBMC |
| 128 | [Documentation] Power on the OBMC system. |
| 129 | |
| 130 | Log To Console Power On OpenBMC... |
| 131 | Click Element ${xpath_display_server_power_status} |
| 132 | Click Button ${xpath_select_button_power_on } |
| 133 | Wait OpenBMC To Become Stable ${obmc_running_state} |
| 134 | |
| 135 | Reboot OpenBMC |
| 136 | [Documentation] Rebooting the OBMC system. |
| 137 | |
| 138 | Log To Console Reboting the OpenBMC... |
| 139 | Click Element ${xpath_display_server_power_status} |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 140 | Click Button ${xpath_select_button_orderly_shutdown} |
| 141 | Click Yes Button ${xpath_select_button_orderly_shutdown_yes} |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 142 | Wait OpenBMC To Become Stable ${obmc_off_state} |
| 143 | |
| 144 | Wait OpenBMC To Become Stable |
| 145 | [Documentation] Power off the OBMC. |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 146 | [Arguments] ${OBMC_expected_state} ${retry_time}=15 min |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 147 | ... ${retry_interval}=45 sec |
| 148 | # Description of argument(s): |
| 149 | # OBMC_expected_state The OBMC state which is required for test. |
| 150 | # retry_time Total wait time after executing the command. |
| 151 | # retry_interval Time interval for to keep checking with in the |
| 152 | # above total wait time. |
| 153 | |
| 154 | Wait Until Keyword Succeeds ${retry_time} ${retry_interval} |
| 155 | ... Wait Until Element Contains ${xpath_display_server_power_status} |
| 156 | ... ${obmc_expected_state} |
| 157 | Wait Until Keyword Succeeds ${retry_time} ${retry_interval} |
| 158 | ... Verify OpenBMC State From REST Interface ${obmc_expected_state} |
| 159 | |
| 160 | Verify OpenBMC State From REST Interface |
| 161 | [Documentation] Verify system state from REST Interface. |
| 162 | [Arguments] ${obmc_required_state} |
| 163 | # Description of argument(s): |
| 164 | # obmc_required_state The OBMC state which is required for test. |
| 165 | |
| 166 | ${obmc_current_state_REST}= Get Host State |
| 167 | Should Be Equal ${obmc_current_state_REST} ${obmc_required_state} |
| 168 | |
| 169 | Click Yes Button |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 170 | [Documentation] Click the 'Yes' button. |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 171 | [Arguments] ${xpath_button_yes} |
| 172 | # Description of argument(s): |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 173 | # xpath_button_yes The xpath of 'Yes' button. |
Sathyajith M S | 4f26ae7 | 2018-01-16 04:45:05 -0600 | [diff] [blame] | 174 | |
| 175 | Click Button ${xpath_button_yes} |
| 176 | |
| 177 | LogOut OpenBMC GUI |
| 178 | [Documentation] Log out of OpenBMC GUI. |
| 179 | SSHLibrary.Close All Connections |
| 180 | click button ${xpath_button_logout} |
| 181 | Wait Until Page Contains Element ${xpath_button_login} |
| 182 | |
| 183 | Test Teardown Execution |
| 184 | [Documentation] Do final closure activities of test case execution. |
| 185 | Rprint Pgm Footer |
| 186 | Print Dashes 0 100 1 = |
| 187 | LogOut OpenBMC GUI |
Sivas SRR | ffa4269 | 2018-01-17 05:17:35 -0600 | [diff] [blame] | 188 | |
| 189 | Open Browser With URL |
| 190 | [Documentation] Open browser with specified URL and returns browser id. |
| 191 | [Arguments] ${URL} ${browser}=gc |
| 192 | # Description of argument(s): |
| 193 | # URL Openbmc GUI URL to be open |
| 194 | # (e.g. https://openbmc-test.mybluemix.net/#/login ) |
| 195 | # browser browser used to open above URL |
| 196 | # (e.g. gc for google chrome, ff for firefox) |
| 197 | ${browser_ID}= Open Browser ${URL} ${browser} |
| 198 | [Return] ${browser_ID} |
| 199 | |
| 200 | Model Server Power Click Button |
| 201 | [Documentation] Click main server power in the header section. |
| 202 | [Arguments] ${div_element} ${anchor_element} |
| 203 | # Description of argument(s): |
| 204 | # div_element Server power header divisional element |
| 205 | # (e.g. header_wrapper.) |
| 206 | # anchor_element Server power header anchor element |
| 207 | # (e.g. header_wrapper_elt.) |
| 208 | Wait Until Element Is Visible |
| 209 | ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span |
| 210 | Click Element |
| 211 | ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span |
| 212 | |
| 213 | Controller Server Power Click Button |
| 214 | [Documentation] Click main server power in the header section. |
| 215 | [Arguments] ${controller_element} |
| 216 | # Description of argument(s): |
| 217 | # controller_element Server power controller element |
| 218 | # (e.g. power__power-on.) |
| 219 | |
| 220 | Wait Until Element Is Visible ${controller_element} |
| 221 | Page Should Contain Button ${controller_element} |
| 222 | Click Element ${controller_element} |
| 223 | |
| 224 | Controller Power Operations Confirmation Click Button |
| 225 | [Documentation] Click Common Power Operations Confirmation. |
| 226 | [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation} |
| 227 | # Description of argument(s): |
| 228 | # main_element Server power operations element |
| 229 | # (e.g. power_operations.) |
| 230 | # sub_element Server power operations sub element |
| 231 | # (e.g. warm_boot, shut_down.) |
| 232 | # confirm_msg_elt Server power operations confirm message element |
| 233 | # (e.g. confirm_msg.) |
| 234 | # confirmation Server power operations confirmation |
| 235 | # (e.g. yes.) |
| 236 | |
| 237 | Click Element |
| 238 | ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}] |
| 239 | |
| 240 | GUI Power On |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 241 | [Documentation] Power on the host using GUI. |
Sivas SRR | ffa4269 | 2018-01-17 05:17:35 -0600 | [diff] [blame] | 242 | |
| 243 | Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt} |
| 244 | Page Should Contain Attempts to power on the server |
| 245 | Controller Server Power Click Button power__power-on |
| 246 | Page Should Contain Running |
| 247 | |
Sathyajith M S | f52d6fc | 2018-01-24 10:11:18 -0600 | [diff] [blame] | 248 | Verify Display Content |
| 249 | [Documentation] Verify text content display. |
| 250 | [Arguments] ${display_text} |
| 251 | |
| 252 | # Description of argument(s): |
| 253 | # display_text The text which is expected to be found on the web page. |
| 254 | |
| 255 | Page Should Contain ${display_text} |
| 256 | |
| 257 | Warm Reboot openBMC |
| 258 | [Documentation] Warm reboot the OBMC system. |
| 259 | |
| 260 | Log To Console Warm Reboting the OpenBMC... |
| 261 | Click Element ${xpath_select_button_warm_reboot} |
| 262 | Verify Warning Message Display Text ${xpath_warm_reboot_warning_message} |
| 263 | ... ${text_warm_reboot_warning_message} |
| 264 | Click Yes Button ${xpath_select_button_warm_reboot_yes} |
| 265 | Wait OpenBMC To Become Stable ${obmc_running_state} |
| 266 | |
| 267 | Click No Button |
| 268 | [Documentation] Click the 'No' button. |
| 269 | [Arguments] ${xpath_button_no} |
| 270 | |
| 271 | # Description of argument(s): |
| 272 | # xpath_button_no The xpath of 'No' button. |
| 273 | |
| 274 | Click Button ${xpath_button_no} |
| 275 | |
| 276 | Cold Reboot openBMC |
| 277 | [Documentation] Cold reboot the OBMC system. |
| 278 | |
| 279 | Log To Console Cold Reboting the OpenBMC... |
| 280 | Click Element ${xpath_select_button_cold_reboot} |
| 281 | Verify Warning Message Display Text ${xpath_cold_reboot_warning_message} |
| 282 | ... ${text_cold_reboot_warning_message} |
| 283 | Click Yes Button ${xpath_select_button_cold_reboot_yes} |
| 284 | Wait OpenBMC To Become Stable ${obmc_running_state} |
| 285 | |
| 286 | Orderly Shutdown OpenBMC |
| 287 | [Documentation] Do orderly shutdown the OBMC system. |
| 288 | |
| 289 | Log To Console Orderly Shutdown the OpenBMC... |
| 290 | Click Element ${xpath_select_button_orderly_shutdown} |
| 291 | Verify Warning Message Display Text ${xpath_orderly_shutdown_warning_message} |
| 292 | ... ${text_orderly_shutdown_warning_message} |
| 293 | Click Yes Button ${xpath_select_button_orderly_shutdown_yes} |
| 294 | Wait OpenBMC To Become Stable ${obmc_off_state} |
| 295 | |
| 296 | Immediate Shutdown openBMC |
| 297 | [Documentation] Do immediate shutdown the OBMC system. |
| 298 | |
| 299 | Log To Console Immediate Shutdown the OpenBMC... |
| 300 | Click Element ${xpath_select_button_immediate_shutdown} |
| 301 | Verify Warning Message Display Text |
| 302 | ... ${xpath_immediate_shutdown_warning_message} |
| 303 | ... ${text_immediate_shutdown_warning_message} |
| 304 | Click Yes Button ${xpath_select_button_immediate_shutdown_yes} |
| 305 | Wait OpenBMC To Become Stable ${obmc_off_state} |
| 306 | |
| 307 | Verify Warning Message Display Text |
| 308 | [Documentation] Verify the warning message display text. |
| 309 | [Arguments] ${xpath_text_message} ${text_message} |
| 310 | |
| 311 | # xpath_text_message Xpath of warning message display. |
| 312 | # text_message Content of the display message info. |
| 313 | |
| 314 | Element Text Should Be ${xpath_text_message} ${text_message} |