blob: 29b676aa4d8db9f0937eca556c248416f1cf113f [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.
28${default_browser} chrome
29
30${obmc_PowerOff_state} Off
31${obmc_PowerRunning_state} Running
32${obmc_PowerQuiesced_state} Quiesced
33
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.
92 [Arguments] ${obmc_test_setup_state}=NONE
93 # 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
101 ${obmc_state}= Run Keyword And Return Status
102 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
103 Return From Keyword If '${obmc_state}' == 'True'
104 ${obmc_quiesced_state}= Run Keyword And Return Status
105 ... Should Contain ${obmc_current_state} ${obmc_quiesced_state}
106 Run Keyword If '${obmc_quiesced_state}' == 'True' Reboot OpenBMC
107 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}'
108 ... Power On OpenBMC
109 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}'
110 ... Power Off OpenBMC
111
112Power Off OpenBMC
113 [Documentation] Power off the OBMC system.
114
115 Log To Console Power Off OpenBMC...
116 Click Element ${xpath_display_server_power_status}
117 Execute JavaScript window.scrollTo(0, document.body.scrollHeight)
118 Click Button ${xpath_select_button_orderly_power_shutdown}
119 Click Yes Button ${xpath_select_button_orderly_power_shutdown_yes}
120 Wait OpenBMC To Become Stable ${obmc_off_state}
121
122Power On OpenBMC
123 [Documentation] Power on the OBMC system.
124
125 Log To Console Power On OpenBMC...
126 Click Element ${xpath_display_server_power_status}
127 Click Button ${xpath_select_button_power_on }
128 Wait OpenBMC To Become Stable ${obmc_running_state}
129
130Reboot OpenBMC
131 [Documentation] Rebooting the OBMC system.
132
133 Log To Console Reboting the OpenBMC...
134 Click Element ${xpath_display_server_power_status}
135 Click Button ${xpath_select_button_orderly_power_shutdown}
136 Click Yes Button ${xpath_select_button_orderly_power_shutdown_yes}
137 Wait OpenBMC To Become Stable ${obmc_off_state}
138
139Wait OpenBMC To Become Stable
140 [Documentation] Power off the OBMC.
141 [Arguments] ${OBMC_expected_state} ${retry_time}=5 min
142 ... ${retry_interval}=45 sec
143 # Description of argument(s):
144 # OBMC_expected_state The OBMC state which is required for test.
145 # retry_time Total wait time after executing the command.
146 # retry_interval Time interval for to keep checking with in the
147 # above total wait time.
148
149 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
150 ... Wait Until Element Contains ${xpath_display_server_power_status}
151 ... ${obmc_expected_state}
152 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
153 ... Verify OpenBMC State From REST Interface ${obmc_expected_state}
154
155Verify OpenBMC State From REST Interface
156 [Documentation] Verify system state from REST Interface.
157 [Arguments] ${obmc_required_state}
158 # Description of argument(s):
159 # obmc_required_state The OBMC state which is required for test.
160
161 ${obmc_current_state_REST}= Get Host State
162 Should Be Equal ${obmc_current_state_REST} ${obmc_required_state}
163
164Click Yes Button
165 [Documentation] Click the 'yes' button.
166 [Arguments] ${xpath_button_yes}
167 # Description of argument(s):
168 # xpath_button_yes The xpath of 'yes' button.
169
170 Click Button ${xpath_button_yes}
171
172LogOut OpenBMC GUI
173 [Documentation] Log out of OpenBMC GUI.
174 SSHLibrary.Close All Connections
175 click button ${xpath_button_logout}
176 Wait Until Page Contains Element ${xpath_button_login}
177
178Test Teardown Execution
179 [Documentation] Do final closure activities of test case execution.
180 Rprint Pgm Footer
181 Print Dashes 0 100 1 =
182 LogOut OpenBMC GUI
Sivas SRRffa42692018-01-17 05:17:35 -0600183
184Open Browser With URL
185 [Documentation] Open browser with specified URL and returns browser id.
186 [Arguments] ${URL} ${browser}=gc
187 # Description of argument(s):
188 # URL Openbmc GUI URL to be open
189 # (e.g. https://openbmc-test.mybluemix.net/#/login )
190 # browser browser used to open above URL
191 # (e.g. gc for google chrome, ff for firefox)
192 ${browser_ID}= Open Browser ${URL} ${browser}
193 [Return] ${browser_ID}
194
195Model Server Power Click Button
196 [Documentation] Click main server power in the header section.
197 [Arguments] ${div_element} ${anchor_element}
198 # Description of argument(s):
199 # div_element Server power header divisional element
200 # (e.g. header_wrapper.)
201 # anchor_element Server power header anchor element
202 # (e.g. header_wrapper_elt.)
203 Wait Until Element Is Visible
204 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
205 Click Element
206 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
207
208Controller Server Power Click Button
209 [Documentation] Click main server power in the header section.
210 [Arguments] ${controller_element}
211 # Description of argument(s):
212 # controller_element Server power controller element
213 # (e.g. power__power-on.)
214
215 Wait Until Element Is Visible ${controller_element}
216 Page Should Contain Button ${controller_element}
217 Click Element ${controller_element}
218
219Controller Power Operations Confirmation Click Button
220 [Documentation] Click Common Power Operations Confirmation.
221 [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation}
222 # Description of argument(s):
223 # main_element Server power operations element
224 # (e.g. power_operations.)
225 # sub_element Server power operations sub element
226 # (e.g. warm_boot, shut_down.)
227 # confirm_msg_elt Server power operations confirm message element
228 # (e.g. confirm_msg.)
229 # confirmation Server power operations confirmation
230 # (e.g. yes.)
231
232 Click Element
233 ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}]
234
235GUI Power On
236 [Documentation] Power on the Host using GUI.
237
238 Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt}
239 Page Should Contain Attempts to power on the server
240 Controller Server Power Click Button power__power-on
241 Page Should Contain Running
242