blob: e4ebc3c4709de9ca268799327073957ced0dd45b [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 S4f26ae72018-01-16 04:45:05 -060027# Default Browser.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060028${default_browser} ff
Sathyajith M S4f26ae72018-01-16 04:45:05 -060029
30${obmc_PowerOff_state} Off
31${obmc_PowerRunning_state} Running
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060032${obmc_PowerStandby_state} Standby
Sathyajith M S4f26ae72018-01-16 04:45:05 -060033
34*** Keywords ***
35Launch 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
45Get 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
57Launch Browser in Windows Platform
58 [Documentation] Open the browser with the URL and
59 ... login on windows platform.
60
Sivas SRRc70e9ae2018-02-14 23:53:49 -060061 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${default_browser}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060062 Maximize Browser Window
63 Set Global Variable ${BROWSER_ID}
64
65Launch Headless Browser
66 [Documentation] Launch headless browser.
67
68 Start Virtual Display 1920 1080
Sivas SRRc70e9ae2018-02-14 23:53:49 -060069 ${BROWSER_ID}= Open Browser ${obmc_gui_url}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060070 Set Global Variable ${BROWSER_ID}
71 Set Window Size 1920 1080
72
73Login 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 SRRc70e9ae2018-02-14 23:53:49 -060081 Go To ${obmc_gui_url}
Sivas SRRa6925352018-02-19 08:59:03 -060082 Wait Until Element Is Enabled ${xpath_textbox_hostname}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060083 Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST}
84 Input Text ${xpath_textbox_username} ${username}
85 Input Password ${xpath_textbox_password} ${password}
Sivas SRRffa42692018-01-17 05:17:35 -060086 Click Element login__submit
Sathyajith M S4f26ae72018-01-16 04:45:05 -060087 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRRffa42692018-01-17 05:17:35 -060088 Page Should Contain Server information
Sathyajith M S4f26ae72018-01-16 04:45:05 -060089
90
91Test Setup Execution
92 [Documentation] Verify all the preconditions to be tested.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060093 [Arguments] ${obmc_test_setup_state}=${OBMC_PowerOff_state}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060094 # 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 Sf52d6fc2018-01-24 10:11:18 -0600102
103 ${obmc_state_status}= Run Keyword And Return Status
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600104 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600105 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 S4f26ae72018-01-16 04:45:05 -0600112 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
117Power 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 Sf52d6fc2018-01-24 10:11:18 -0600123 Click Button ${xpath_select_button_orderly_shutdown}
124 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600125 Wait OpenBMC To Become Stable ${obmc_off_state}
126
127Power 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
135Reboot 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 Sf52d6fc2018-01-24 10:11:18 -0600140 Click Button ${xpath_select_button_orderly_shutdown}
141 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600142 Wait OpenBMC To Become Stable ${obmc_off_state}
143
144Wait OpenBMC To Become Stable
145 [Documentation] Power off the OBMC.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600146 [Arguments] ${OBMC_expected_state} ${retry_time}=15 min
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600147 ... ${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
160Verify 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
169Click Yes Button
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600170 [Documentation] Click the 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600171 [Arguments] ${xpath_button_yes}
172 # Description of argument(s):
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600173 # xpath_button_yes The xpath of 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600174
175 Click Button ${xpath_button_yes}
176
177LogOut 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
183Test 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 SRRffa42692018-01-17 05:17:35 -0600188
189Open 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
200Model 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
213Controller 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
224Controller 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
240GUI Power On
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600241 [Documentation] Power on the host using GUI.
Sivas SRRffa42692018-01-17 05:17:35 -0600242
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 Sf52d6fc2018-01-24 10:11:18 -0600248Verify 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
257Warm 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
267Click 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
276Cold 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
286Orderly 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
296Immediate 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
307Verify 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}