blob: 3e5c90dff522e5871cc43131110b79bf5db3a789 [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 SRRffa42692018-01-17 05:17:35 -060026${openbmc_gui_url} http://localhost:8080/#/login
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 SRRffa42692018-01-17 05:17:35 -060061 ${BROWSER_ID}= Open Browser ${openbmc_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 SRRffa42692018-01-17 05:17:35 -060069 ${BROWSER_ID}= Open Browser ${openbmc_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 SRRffa42692018-01-17 05:17:35 -060081 Go To ${openbmc_gui_url}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060082 Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST}
83 Input Text ${xpath_textbox_username} ${username}
84 Input Password ${xpath_textbox_password} ${password}
Sivas SRRffa42692018-01-17 05:17:35 -060085 Click Element login__submit
Sathyajith M S4f26ae72018-01-16 04:45:05 -060086 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRRffa42692018-01-17 05:17:35 -060087 Page Should Contain Server information
Sathyajith M S4f26ae72018-01-16 04:45:05 -060088
89
90Test Setup Execution
91 [Documentation] Verify all the preconditions to be tested.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060092 [Arguments] ${obmc_test_setup_state}=${OBMC_PowerOff_state}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060093 # Description of argument(s):
94 # obmc_test_setup The OpenBMC required state.
95
96 Rprint Timen ${TEST NAME} ==> [STARTED]
97 Login OpenBMC GUI
98 Log To Console Verifying the system state and stablity...
99 ${obmc_current_state}= Get Text ${xpath_display_server_power_status}
100 Rpvars obmc_current_state
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600101
102 ${obmc_state_status}= Run Keyword And Return Status
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600103 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600104 Return From Keyword If '${obmc_state_status}' == 'True'
105
106 ${obmc_standby_state}= Run Keyword And Return Status
107 ... Should Contain ${obmc_current_state} ${obmc_standby_state}
108
109 Run Keyword If '${obmc_standby_state}' == 'True'
110 ... Reboot OpenBMC
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600111 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}'
112 ... Power On OpenBMC
113 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}'
114 ... Power Off OpenBMC
115
116Power Off OpenBMC
117 [Documentation] Power off the OBMC system.
118
119 Log To Console Power Off OpenBMC...
120 Click Element ${xpath_display_server_power_status}
121 Execute JavaScript window.scrollTo(0, document.body.scrollHeight)
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600122 Click Button ${xpath_select_button_orderly_shutdown}
123 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600124 Wait OpenBMC To Become Stable ${obmc_off_state}
125
126Power On OpenBMC
127 [Documentation] Power on the OBMC system.
128
129 Log To Console Power On OpenBMC...
130 Click Element ${xpath_display_server_power_status}
131 Click Button ${xpath_select_button_power_on }
132 Wait OpenBMC To Become Stable ${obmc_running_state}
133
134Reboot OpenBMC
135 [Documentation] Rebooting the OBMC system.
136
137 Log To Console Reboting the OpenBMC...
138 Click Element ${xpath_display_server_power_status}
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
143Wait OpenBMC To Become Stable
144 [Documentation] Power off the OBMC.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600145 [Arguments] ${OBMC_expected_state} ${retry_time}=15 min
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600146 ... ${retry_interval}=45 sec
147 # Description of argument(s):
148 # OBMC_expected_state The OBMC state which is required for test.
149 # retry_time Total wait time after executing the command.
150 # retry_interval Time interval for to keep checking with in the
151 # above total wait time.
152
153 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
154 ... Wait Until Element Contains ${xpath_display_server_power_status}
155 ... ${obmc_expected_state}
156 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
157 ... Verify OpenBMC State From REST Interface ${obmc_expected_state}
158
159Verify OpenBMC State From REST Interface
160 [Documentation] Verify system state from REST Interface.
161 [Arguments] ${obmc_required_state}
162 # Description of argument(s):
163 # obmc_required_state The OBMC state which is required for test.
164
165 ${obmc_current_state_REST}= Get Host State
166 Should Be Equal ${obmc_current_state_REST} ${obmc_required_state}
167
168Click Yes Button
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600169 [Documentation] Click the 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600170 [Arguments] ${xpath_button_yes}
171 # Description of argument(s):
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600172 # xpath_button_yes The xpath of 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600173
174 Click Button ${xpath_button_yes}
175
176LogOut OpenBMC GUI
177 [Documentation] Log out of OpenBMC GUI.
178 SSHLibrary.Close All Connections
179 click button ${xpath_button_logout}
180 Wait Until Page Contains Element ${xpath_button_login}
181
182Test Teardown Execution
183 [Documentation] Do final closure activities of test case execution.
184 Rprint Pgm Footer
185 Print Dashes 0 100 1 =
186 LogOut OpenBMC GUI
Sivas SRRffa42692018-01-17 05:17:35 -0600187
188Open Browser With URL
189 [Documentation] Open browser with specified URL and returns browser id.
190 [Arguments] ${URL} ${browser}=gc
191 # Description of argument(s):
192 # URL Openbmc GUI URL to be open
193 # (e.g. https://openbmc-test.mybluemix.net/#/login )
194 # browser browser used to open above URL
195 # (e.g. gc for google chrome, ff for firefox)
196 ${browser_ID}= Open Browser ${URL} ${browser}
197 [Return] ${browser_ID}
198
199Model Server Power Click Button
200 [Documentation] Click main server power in the header section.
201 [Arguments] ${div_element} ${anchor_element}
202 # Description of argument(s):
203 # div_element Server power header divisional element
204 # (e.g. header_wrapper.)
205 # anchor_element Server power header anchor element
206 # (e.g. header_wrapper_elt.)
207 Wait Until Element Is Visible
208 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
209 Click Element
210 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
211
212Controller Server Power Click Button
213 [Documentation] Click main server power in the header section.
214 [Arguments] ${controller_element}
215 # Description of argument(s):
216 # controller_element Server power controller element
217 # (e.g. power__power-on.)
218
219 Wait Until Element Is Visible ${controller_element}
220 Page Should Contain Button ${controller_element}
221 Click Element ${controller_element}
222
223Controller Power Operations Confirmation Click Button
224 [Documentation] Click Common Power Operations Confirmation.
225 [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation}
226 # Description of argument(s):
227 # main_element Server power operations element
228 # (e.g. power_operations.)
229 # sub_element Server power operations sub element
230 # (e.g. warm_boot, shut_down.)
231 # confirm_msg_elt Server power operations confirm message element
232 # (e.g. confirm_msg.)
233 # confirmation Server power operations confirmation
234 # (e.g. yes.)
235
236 Click Element
237 ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}]
238
239GUI Power On
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600240 [Documentation] Power on the host using GUI.
Sivas SRRffa42692018-01-17 05:17:35 -0600241
242 Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt}
243 Page Should Contain Attempts to power on the server
244 Controller Server Power Click Button power__power-on
245 Page Should Contain Running
246
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600247Verify Display Content
248 [Documentation] Verify text content display.
249 [Arguments] ${display_text}
250
251 # Description of argument(s):
252 # display_text The text which is expected to be found on the web page.
253
254 Page Should Contain ${display_text}
255
256Warm Reboot openBMC
257 [Documentation] Warm reboot the OBMC system.
258
259 Log To Console Warm Reboting the OpenBMC...
260 Click Element ${xpath_select_button_warm_reboot}
261 Verify Warning Message Display Text ${xpath_warm_reboot_warning_message}
262 ... ${text_warm_reboot_warning_message}
263 Click Yes Button ${xpath_select_button_warm_reboot_yes}
264 Wait OpenBMC To Become Stable ${obmc_running_state}
265
266Click No Button
267 [Documentation] Click the 'No' button.
268 [Arguments] ${xpath_button_no}
269
270 # Description of argument(s):
271 # xpath_button_no The xpath of 'No' button.
272
273 Click Button ${xpath_button_no}
274
275Cold Reboot openBMC
276 [Documentation] Cold reboot the OBMC system.
277
278 Log To Console Cold Reboting the OpenBMC...
279 Click Element ${xpath_select_button_cold_reboot}
280 Verify Warning Message Display Text ${xpath_cold_reboot_warning_message}
281 ... ${text_cold_reboot_warning_message}
282 Click Yes Button ${xpath_select_button_cold_reboot_yes}
283 Wait OpenBMC To Become Stable ${obmc_running_state}
284
285Orderly Shutdown OpenBMC
286 [Documentation] Do orderly shutdown the OBMC system.
287
288 Log To Console Orderly Shutdown the OpenBMC...
289 Click Element ${xpath_select_button_orderly_shutdown}
290 Verify Warning Message Display Text ${xpath_orderly_shutdown_warning_message}
291 ... ${text_orderly_shutdown_warning_message}
292 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
293 Wait OpenBMC To Become Stable ${obmc_off_state}
294
295Immediate Shutdown openBMC
296 [Documentation] Do immediate shutdown the OBMC system.
297
298 Log To Console Immediate Shutdown the OpenBMC...
299 Click Element ${xpath_select_button_immediate_shutdown}
300 Verify Warning Message Display Text
301 ... ${xpath_immediate_shutdown_warning_message}
302 ... ${text_immediate_shutdown_warning_message}
303 Click Yes Button ${xpath_select_button_immediate_shutdown_yes}
304 Wait OpenBMC To Become Stable ${obmc_off_state}
305
306Verify Warning Message Display Text
307 [Documentation] Verify the warning message display text.
308 [Arguments] ${xpath_text_message} ${text_message}
309
310 # xpath_text_message Xpath of warning message display.
311 # text_message Content of the display message info.
312
313 Element Text Should Be ${xpath_text_message} ${text_message}