blob: da77d1bcd64de6e737ae32a397218e7dee20cb38 [file] [log] [blame]
Sathyajith M S4f26ae72018-01-16 04:45:05 -06001*** Settings ***
2Documentation This is a resource file of OpenBMC ASMI It contains the
3... user-defined keywords which are available to all gui modules
4
5Library String
6Library Collections
7Library DateTime
8Library XvfbRobot
9Library OperatingSystem
10Library Selenium2Library 120 120
11Library AngularJSLibrary
12Library SSHLibrary 30 Seconds
13Library Process
14Library supporting_libs.py
15Library ../../../lib/gen_print.py
16Library ../../../lib/gen_robot_print.py
17Library ../../../lib/gen_valid.py
18Library ../../../lib/gen_robot_ssh.py
19Library ../../../lib/bmc_ssh_utils.py
20Resource ../../../lib/resource.txt
21Resource ../../../lib/rest_client.robot
22Resource ../../../lib/state_manager.robot
23Variables ../data/resource_variables.py
24
25*** Variables ***
Sivas SRRc70e9ae2018-02-14 23:53:49 -060026${obmc_gui_url} https://${OPENBMC_HOST}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060027
Sathyajith M S4f26ae72018-01-16 04:45:05 -060028# Default Browser.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060029${default_browser} ff
Sathyajith M S4f26ae72018-01-16 04:45:05 -060030
31${obmc_PowerOff_state} Off
32${obmc_PowerRunning_state} Running
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060033${obmc_PowerStandby_state} Standby
Sathyajith M S4f26ae72018-01-16 04:45:05 -060034
35*** Keywords ***
36Launch OpenBMC GUI Browser
37 [Documentation] Launch the OpenBMC GUI URL on a browser.
38 # By default uses headless mode, otherwise, the GUI browser.
39
40 ${op_system}= Get Operating System
41 Run Keyword If '${op_system}' == 'windows'
42 ... Launch Browser in Windows Platform
43 ... ELSE
44 ... Launch Headless Browser
45
46Get Operating System
47 [Documentation] Identify platform/OS.
48
49 ${curdir_lower_case}= Convert To Lowercase ${CURDIR}
50 ${windows_platform}= Run Keyword And Return Status
51 ... Should Contain ${curdir_lower_case} c:\
52 ${op_system}= Run Keyword If '${windows_platform}' == 'True'
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060053 ... Set Variable windows
54 ... ELSE
55 ... Set Variable linux
Sathyajith M S4f26ae72018-01-16 04:45:05 -060056 [Return] ${op_system}
57
58Launch Browser in Windows Platform
59 [Documentation] Open the browser with the URL and
60 ... login on windows platform.
61
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060062 ${browser_choice}= Run Keyword And Return Status
63 ... Variable Should Exist ${BROWSER_TYPE}
64 Run Keyword If '${browser_choice}' == 'True'
65 ... Launch Browser ${BROWSER_TYPE}
66 ... ELSE
67 ... Launch Browser
68
69Launch Browser
70 [Documentation] Launches the desired browser.
71 [Arguments] ${launch_browser}=${default_browser}
72
73 # launch_browser Open the required browser.
74
75 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${launch_browser}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060076 Maximize Browser Window
77 Set Global Variable ${BROWSER_ID}
78
79Launch Headless Browser
80 [Documentation] Launch headless browser.
81
82 Start Virtual Display 1920 1080
Sivas SRRc70e9ae2018-02-14 23:53:49 -060083 ${BROWSER_ID}= Open Browser ${obmc_gui_url}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060084 Set Global Variable ${BROWSER_ID}
85 Set Window Size 1920 1080
86
87Login OpenBMC GUI
88 [Documentation] Perform login to open BMC GUI.
89 [Arguments] ${username}=${OPENBMC_USERNAME}
90 ... ${password}=${OPENBMC_PASSWORD}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060091
Sathyajith M S4f26ae72018-01-16 04:45:05 -060092 # Description of argument(s):
93 # username The username.
94 # password The password.
95
Sivas SRRc70e9ae2018-02-14 23:53:49 -060096 Go To ${obmc_gui_url}
Sivas SRRa6925352018-02-19 08:59:03 -060097 Wait Until Element Is Enabled ${xpath_textbox_hostname}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060098 Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST}
99 Input Text ${xpath_textbox_username} ${username}
100 Input Password ${xpath_textbox_password} ${password}
Sivas SRRffa42692018-01-17 05:17:35 -0600101 Click Element login__submit
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600102 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRRffa42692018-01-17 05:17:35 -0600103 Page Should Contain Server information
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600104
105
106Test Setup Execution
107 [Documentation] Verify all the preconditions to be tested.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600108 [Arguments] ${obmc_test_setup_state}=${OBMC_PowerOff_state}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600109
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600110 # Description of argument(s):
111 # obmc_test_setup The OpenBMC required state.
112
113 Rprint Timen ${TEST NAME} ==> [STARTED]
114 Login OpenBMC GUI
115 Log To Console Verifying the system state and stablity...
116 ${obmc_current_state}= Get Text ${xpath_display_server_power_status}
117 Rpvars obmc_current_state
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600118
119 ${obmc_state_status}= Run Keyword And Return Status
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600120 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600121 Return From Keyword If '${obmc_state_status}' == 'True'
122
123 ${obmc_standby_state}= Run Keyword And Return Status
124 ... Should Contain ${obmc_current_state} ${obmc_standby_state}
125
126 Run Keyword If '${obmc_standby_state}' == 'True'
127 ... Reboot OpenBMC
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600128 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}'
129 ... Power On OpenBMC
130 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}'
131 ... Power Off OpenBMC
132
133Power Off OpenBMC
134 [Documentation] Power off the OBMC system.
135
136 Log To Console Power Off OpenBMC...
137 Click Element ${xpath_display_server_power_status}
138 Execute JavaScript window.scrollTo(0, document.body.scrollHeight)
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600139 Click Button ${xpath_select_button_orderly_shutdown}
140 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600141 Wait OpenBMC To Become Stable ${obmc_off_state}
142
143Power On OpenBMC
144 [Documentation] Power on the OBMC system.
145
146 Log To Console Power On OpenBMC...
147 Click Element ${xpath_display_server_power_status}
148 Click Button ${xpath_select_button_power_on }
149 Wait OpenBMC To Become Stable ${obmc_running_state}
150
151Reboot OpenBMC
152 [Documentation] Rebooting the OBMC system.
153
154 Log To Console Reboting the OpenBMC...
155 Click Element ${xpath_display_server_power_status}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600156 Click Button ${xpath_select_button_orderly_shutdown}
157 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600158 Wait OpenBMC To Become Stable ${obmc_off_state}
159
160Wait OpenBMC To Become Stable
161 [Documentation] Power off the OBMC.
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600162 [Arguments] ${obmc_expected_state} ${retry_time}=15 min
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600163 ... ${retry_interval}=45 sec
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600164
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600165 # Description of argument(s):
166 # OBMC_expected_state The OBMC state which is required for test.
167 # retry_time Total wait time after executing the command.
168 # retry_interval Time interval for to keep checking with in the
169 # above total wait time.
170
171 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
172 ... Wait Until Element Contains ${xpath_display_server_power_status}
173 ... ${obmc_expected_state}
174 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
175 ... Verify OpenBMC State From REST Interface ${obmc_expected_state}
176
177Verify OpenBMC State From REST Interface
178 [Documentation] Verify system state from REST Interface.
179 [Arguments] ${obmc_required_state}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600180
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600181 # Description of argument(s):
182 # obmc_required_state The OBMC state which is required for test.
183
184 ${obmc_current_state_REST}= Get Host State
185 Should Be Equal ${obmc_current_state_REST} ${obmc_required_state}
186
187Click Yes Button
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600188 [Documentation] Click the 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600189 [Arguments] ${xpath_button_yes}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600190
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600191 # Description of argument(s):
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600192 # xpath_button_yes The xpath of 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600193
194 Click Button ${xpath_button_yes}
195
196LogOut OpenBMC GUI
197 [Documentation] Log out of OpenBMC GUI.
198 SSHLibrary.Close All Connections
199 click button ${xpath_button_logout}
200 Wait Until Page Contains Element ${xpath_button_login}
201
202Test Teardown Execution
203 [Documentation] Do final closure activities of test case execution.
204 Rprint Pgm Footer
205 Print Dashes 0 100 1 =
206 LogOut OpenBMC GUI
Sivas SRRffa42692018-01-17 05:17:35 -0600207
208Open Browser With URL
209 [Documentation] Open browser with specified URL and returns browser id.
210 [Arguments] ${URL} ${browser}=gc
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600211
Sivas SRRffa42692018-01-17 05:17:35 -0600212 # Description of argument(s):
213 # URL Openbmc GUI URL to be open
214 # (e.g. https://openbmc-test.mybluemix.net/#/login )
215 # browser browser used to open above URL
216 # (e.g. gc for google chrome, ff for firefox)
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600217
Sivas SRRffa42692018-01-17 05:17:35 -0600218 ${browser_ID}= Open Browser ${URL} ${browser}
219 [Return] ${browser_ID}
220
221Model Server Power Click Button
222 [Documentation] Click main server power in the header section.
223 [Arguments] ${div_element} ${anchor_element}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600224
Sivas SRRffa42692018-01-17 05:17:35 -0600225 # Description of argument(s):
226 # div_element Server power header divisional element
227 # (e.g. header_wrapper.)
228 # anchor_element Server power header anchor element
229 # (e.g. header_wrapper_elt.)
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600230
Sivas SRRffa42692018-01-17 05:17:35 -0600231 Wait Until Element Is Visible
232 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
233 Click Element
234 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
235
236Controller Server Power Click Button
237 [Documentation] Click main server power in the header section.
238 [Arguments] ${controller_element}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600239
Sivas SRRffa42692018-01-17 05:17:35 -0600240 # Description of argument(s):
241 # controller_element Server power controller element
242 # (e.g. power__power-on.)
243
244 Wait Until Element Is Visible ${controller_element}
245 Page Should Contain Button ${controller_element}
246 Click Element ${controller_element}
247
248Controller Power Operations Confirmation Click Button
249 [Documentation] Click Common Power Operations Confirmation.
250 [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600251
Sivas SRRffa42692018-01-17 05:17:35 -0600252 # Description of argument(s):
253 # main_element Server power operations element
254 # (e.g. power_operations.)
255 # sub_element Server power operations sub element
256 # (e.g. warm_boot, shut_down.)
257 # confirm_msg_elt Server power operations confirm message element
258 # (e.g. confirm_msg.)
259 # confirmation Server power operations confirmation
260 # (e.g. yes.)
261
262 Click Element
263 ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}]
264
265GUI Power On
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600266 [Documentation] Power on the host using GUI.
Sivas SRRffa42692018-01-17 05:17:35 -0600267
268 Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt}
269 Page Should Contain Attempts to power on the server
270 Controller Server Power Click Button power__power-on
271 Page Should Contain Running
272
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600273Verify Display Content
274 [Documentation] Verify text content display.
275 [Arguments] ${display_text}
276
277 # Description of argument(s):
278 # display_text The text which is expected to be found on the web page.
279
280 Page Should Contain ${display_text}
281
282Warm Reboot openBMC
283 [Documentation] Warm reboot the OBMC system.
284
285 Log To Console Warm Reboting the OpenBMC...
286 Click Element ${xpath_select_button_warm_reboot}
287 Verify Warning Message Display Text ${xpath_warm_reboot_warning_message}
288 ... ${text_warm_reboot_warning_message}
289 Click Yes Button ${xpath_select_button_warm_reboot_yes}
290 Wait OpenBMC To Become Stable ${obmc_running_state}
291
292Click No Button
293 [Documentation] Click the 'No' button.
294 [Arguments] ${xpath_button_no}
295
296 # Description of argument(s):
297 # xpath_button_no The xpath of 'No' button.
298
299 Click Button ${xpath_button_no}
300
301Cold Reboot openBMC
302 [Documentation] Cold reboot the OBMC system.
303
304 Log To Console Cold Reboting the OpenBMC...
305 Click Element ${xpath_select_button_cold_reboot}
306 Verify Warning Message Display Text ${xpath_cold_reboot_warning_message}
307 ... ${text_cold_reboot_warning_message}
308 Click Yes Button ${xpath_select_button_cold_reboot_yes}
309 Wait OpenBMC To Become Stable ${obmc_running_state}
310
311Orderly Shutdown OpenBMC
312 [Documentation] Do orderly shutdown the OBMC system.
313
314 Log To Console Orderly Shutdown the OpenBMC...
315 Click Element ${xpath_select_button_orderly_shutdown}
316 Verify Warning Message Display Text ${xpath_orderly_shutdown_warning_message}
317 ... ${text_orderly_shutdown_warning_message}
318 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
319 Wait OpenBMC To Become Stable ${obmc_off_state}
320
321Immediate Shutdown openBMC
322 [Documentation] Do immediate shutdown the OBMC system.
323
324 Log To Console Immediate Shutdown the OpenBMC...
325 Click Element ${xpath_select_button_immediate_shutdown}
326 Verify Warning Message Display Text
327 ... ${xpath_immediate_shutdown_warning_message}
328 ... ${text_immediate_shutdown_warning_message}
329 Click Yes Button ${xpath_select_button_immediate_shutdown_yes}
330 Wait OpenBMC To Become Stable ${obmc_off_state}
331
332Verify Warning Message Display Text
333 [Documentation] Verify the warning message display text.
334 [Arguments] ${xpath_text_message} ${text_message}
335
336 # xpath_text_message Xpath of warning message display.
337 # text_message Content of the display message info.
338
339 Element Text Should Be ${xpath_text_message} ${text_message}
Sivas SRRca534e62018-02-20 02:22:02 -0600340
341
342Expected Initial Test State
343 [Documentation] Power on the host if "Running" expected, Power off the
344 ... host if "Off" expected as per the requirement of initial test state.
345 [Arguments] ${expectedState}
346 # Description of argument(s):
347 # expectedState Test initial host state.
348
349 Run Keyword If '${expectedState}' == 'Running'
350 ... Initiate Host Boot
351
352 Run Keyword If '${expectedState}' == 'Off'
353 ... Initiate Host PowerOff
Sivas SRR008dcc62018-02-27 06:34:56 -0600354
355Launch Browser And Login OpenBMC GUI
356 [Documentation] Launch browser and log into openbmc GUI.
357
358 Open Browser With URL ${obmc_gui_url}
359 Login OpenBMC GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
360
361Logout And Close Browser
362 [Documentation] Logout from openbmc application and close the browser.
363
364 Click Element header
365 Close Browser