blob: 00a075f444e1ce5e2d9ce590258db013e5f14263 [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
Rahul Maheshwari2b666cc2019-09-02 23:53:37 -050010Library SeleniumLibrary
Sathyajith M S4f26ae72018-01-16 04:45:05 -060011Library AngularJSLibrary
12Library SSHLibrary 30 Seconds
13Library Process
14Library supporting_libs.py
Rahul Maheshwari439ce712019-03-07 03:23:13 -060015Library ../../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.robot
21Resource ../../lib/rest_client.robot
22Resource ../../lib/state_manager.robot
Sathyajith M S4f26ae72018-01-16 04:45:05 -060023Variables ../data/resource_variables.py
24
25*** Variables ***
Sridevi Rameshfba7a392025-03-27 10:21:40 -050026${OPENBMC_GUI_URL} https://${OPENBMC_HOST}:${HTTPS_PORT}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060027
Sathyajith M S4f26ae72018-01-16 04:45:05 -060028${obmc_PowerOff_state} Off
29${obmc_PowerRunning_state} Running
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -060030${obmc_PowerStandby_state} Standby
Sathyajith M S4f26ae72018-01-16 04:45:05 -060031
George Keishing4d4ef992021-01-28 09:56:53 -060032# Default GUI browser and mode is set to "Firefox" and "headless"
Rahul Maheshwaridd38aef2018-11-15 23:33:10 -060033# respectively here.
34${GUI_BROWSER} ff
35${GUI_MODE} headless
36
manashsarmafb353662020-08-27 05:12:04 -050037${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
38... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
39... xyz.openbmc_project.Logging.Entry.Level.Error 0
40
Sathyajith M S4f26ae72018-01-16 04:45:05 -060041*** Keywords ***
42Launch OpenBMC GUI Browser
43 [Documentation] Launch the OpenBMC GUI URL on a browser.
44 # By default uses headless mode, otherwise, the GUI browser.
45
46 ${op_system}= Get Operating System
47 Run Keyword If '${op_system}' == 'windows'
Sivas SRRa0113482018-02-22 22:27:05 -060048 ... Launch Header Browser
49 ... ELSE IF '${op_system}' == 'Darwin'
50 # Mac OS is currently having some issues with firefox, so using
51 # chrome.
Sivas SRRa0113482018-02-22 22:27:05 -060052 ... Launch Header Browser chrome
Sathyajith M S4f26ae72018-01-16 04:45:05 -060053 ... ELSE
Sivas SRRa0113482018-02-22 22:27:05 -060054 # Linux OS.
Sathyajith M S4f26ae72018-01-16 04:45:05 -060055 ... Launch Headless Browser
56
57Get Operating System
58 [Documentation] Identify platform/OS.
59
60 ${curdir_lower_case}= Convert To Lowercase ${CURDIR}
61 ${windows_platform}= Run Keyword And Return Status
62 ... Should Contain ${curdir_lower_case} c:\
63 ${op_system}= Run Keyword If '${windows_platform}' == 'True'
Sivas SRRa0113482018-02-22 22:27:05 -060064 ... Set Variable windows
65 ... ELSE
66 ... Run uname
George Keishing409df052024-01-17 22:36:14 +053067 RETURN ${op_system}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060068
Sivas SRRa0113482018-02-22 22:27:05 -060069Launch Header Browser
Sathyajith M S4f26ae72018-01-16 04:45:05 -060070 [Documentation] Open the browser with the URL and
71 ... login on windows platform.
Rahul Maheshwaridd38aef2018-11-15 23:33:10 -060072 [Arguments] ${browser_type}=${GUI_BROWSER}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060073
Sivas SRRa0113482018-02-22 22:27:05 -060074 # Description of argument(s):
75 # browser_type Type of browser (e.g. "firefox", "chrome", etc.).
Sathyajith M S2cdab0a2018-02-13 19:36:28 -060076
Sridevi Rameshfba7a392025-03-27 10:21:40 -050077 ${BROWSER_ID}= Open Browser ${OPENBMC_GUI_URL} ${browser_type}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060078 Maximize Browser Window
79 Set Global Variable ${BROWSER_ID}
80
81Launch Headless Browser
82 [Documentation] Launch headless browser.
Sridevi Rameshfba7a392025-03-27 10:21:40 -050083 [Arguments] ${URL}=${OPENBMC_GUI_URL} ${browser}=${GUI_BROWSER}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060084
Rahul Maheshwari79e276c2018-06-11 01:23:15 -050085 # Description of argument(s):
86 # URL Openbmc GUI URL to be open
87 # (e.g. https://openbmc-test.mybluemix.net/#/login).
88 # browser Browser to open given URL in headless way
89 # (e.g. gc for google chrome, ff for firefox).
90
91 Start Virtual Display
92 ${browser_ID}= Open Browser ${URL}
Sathyajith M S4f26ae72018-01-16 04:45:05 -060093 Set Window Size 1920 1080
94
George Keishing409df052024-01-17 22:36:14 +053095 RETURN ${browser_ID}
Rahul Maheshwari79e276c2018-06-11 01:23:15 -050096
Sathyajith M S4f26ae72018-01-16 04:45:05 -060097Login OpenBMC GUI
98 [Documentation] Perform login to open BMC GUI.
99 [Arguments] ${username}=${OPENBMC_USERNAME}
100 ... ${password}=${OPENBMC_PASSWORD}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600101
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600102 # Description of argument(s):
103 # username The username.
104 # password The password.
105
Sridevi Rameshfba7a392025-03-27 10:21:40 -0500106 Go To ${OPENBMC_GUI_URL}
Sivas SRRa6925352018-02-19 08:59:03 -0600107 Wait Until Element Is Enabled ${xpath_textbox_hostname}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600108 Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST}
109 Input Text ${xpath_textbox_username} ${username}
110 Input Password ${xpath_textbox_password} ${password}
Sivas SRRffa42692018-01-17 05:17:35 -0600111 Click Element login__submit
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600112 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRRffa42692018-01-17 05:17:35 -0600113 Page Should Contain Server information
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600114
115
116Test Setup Execution
117 [Documentation] Verify all the preconditions to be tested.
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600118 [Arguments] ${obmc_test_setup_state}=${OBMC_PowerOff_state}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600119
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600120 # Description of argument(s):
121 # obmc_test_setup The OpenBMC required state.
122
Michael Walshc108e422019-03-28 12:27:18 -0500123 Print Timen ${TEST NAME} ==> [STARTED]
Rahul Maheshwari7872f052018-06-19 01:12:34 -0500124 Launch Browser And Login OpenBMC GUI
George Keishing9bfdf8a2024-04-19 11:09:07 +0530125 Log To Console Verifying the system state and stability.
Rahul Maheshwari8b5b5a42018-11-30 01:41:35 -0600126
Anusha Dathatrif7a407c2019-07-22 00:59:38 -0500127 Click Element ${xpath_select_server_power}
Anusha Dathatrif93a5c42019-07-24 05:29:44 -0500128 Wait Until Page Does Not Contain Unreachable
Rahul Maheshwari8b5b5a42018-11-30 01:41:35 -0600129 ${obmc_current_state}= Get Text ${xpath_power_indicator}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600130 Rpvars obmc_current_state
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600131
132 ${obmc_state_status}= Run Keyword And Return Status
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600133 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600134 Return From Keyword If '${obmc_state_status}' == 'True'
135
136 ${obmc_standby_state}= Run Keyword And Return Status
137 ... Should Contain ${obmc_current_state} ${obmc_standby_state}
138
139 Run Keyword If '${obmc_standby_state}' == 'True'
140 ... Reboot OpenBMC
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600141 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}'
Rahul Maheshwari1ea8fec2018-12-07 12:42:04 -0600142 ... Run Keywords Power On OpenBMC AND
143 ... Wait Until Keyword Succeeds 10 min 60 sec Is Host Running
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600144 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}'
Anusha Dathatri37159da2019-10-01 04:51:26 -0500145 ... Run Keywords Redfish.Login AND Redfish Power Off AND Redfish.Logout
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600146
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600147
148Power On OpenBMC
149 [Documentation] Power on the OBMC system.
150
151 Log To Console Power On OpenBMC...
Anusha Dathatrif93a5c42019-07-24 05:29:44 -0500152 Click Element ${xpath_select_server_power}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600153 Click Button ${xpath_select_button_power_on }
154 Wait OpenBMC To Become Stable ${obmc_running_state}
155
156Reboot OpenBMC
157 [Documentation] Rebooting the OBMC system.
158
159 Log To Console Reboting the OpenBMC...
Anusha Dathatrif93a5c42019-07-24 05:29:44 -0500160 Click Element ${xpath_select_server_power}
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600161 Click Button ${xpath_select_button_orderly_shutdown}
162 Click Yes Button ${xpath_select_button_orderly_shutdown_yes}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600163 Wait OpenBMC To Become Stable ${obmc_off_state}
164
165Wait OpenBMC To Become Stable
166 [Documentation] Power off the OBMC.
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600167 [Arguments] ${obmc_expected_state} ${retry_time}=15 min
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600168 ... ${retry_interval}=45 sec
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600169
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600170 # Description of argument(s):
171 # OBMC_expected_state The OBMC state which is required for test.
172 # retry_time Total wait time after executing the command.
173 # retry_interval Time interval for to keep checking with in the
174 # above total wait time.
175
176 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
Anusha Dathatrif93a5c42019-07-24 05:29:44 -0500177 ... Wait Until Element Contains ${xpath_select_server_power}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600178 ... ${obmc_expected_state}
179 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
180 ... Verify OpenBMC State From REST Interface ${obmc_expected_state}
181
182Verify OpenBMC State From REST Interface
183 [Documentation] Verify system state from REST Interface.
184 [Arguments] ${obmc_required_state}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600185
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600186 # Description of argument(s):
187 # obmc_required_state The OBMC state which is required for test.
188
189 ${obmc_current_state_REST}= Get Host State
190 Should Be Equal ${obmc_current_state_REST} ${obmc_required_state}
191
192Click Yes Button
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600193 [Documentation] Click the 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600194 [Arguments] ${xpath_button_yes}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600195
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600196 # Description of argument(s):
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600197 # xpath_button_yes The xpath of 'Yes' button.
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600198
199 Click Button ${xpath_button_yes}
200
201LogOut OpenBMC GUI
202 [Documentation] Log out of OpenBMC GUI.
203 SSHLibrary.Close All Connections
Rahul Maheshwari31b3c432020-06-26 05:24:13 -0500204 Click Button ${xpath_button_user_action}
Rahul Maheshwarid36b6ac2018-06-19 01:44:06 -0500205 Click Element ${xpath_button_logout}
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600206 Wait Until Page Contains Element ${xpath_button_login}
207
208Test Teardown Execution
209 [Documentation] Do final closure activities of test case execution.
Michael Walshc108e422019-03-28 12:27:18 -0500210 Print Pgm Footer
Sathyajith M S4f26ae72018-01-16 04:45:05 -0600211 Print Dashes 0 100 1 =
Rahul Maheshwaricfdec852018-11-30 03:44:49 -0600212 Close Browser
Sivas SRRffa42692018-01-17 05:17:35 -0600213
Rahul Maheshwari1b5369b2018-06-11 00:57:03 -0500214
Sivas SRRffa42692018-01-17 05:17:35 -0600215Open Browser With URL
216 [Documentation] Open browser with specified URL and returns browser id.
Rahul Maheshwaridd38aef2018-11-15 23:33:10 -0600217 [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600218
Sivas SRRffa42692018-01-17 05:17:35 -0600219 # Description of argument(s):
220 # URL Openbmc GUI URL to be open
Rahul Maheshwari79e276c2018-06-11 01:23:15 -0500221 # (e.g. https://openbmc-test.mybluemix.net/#/login).
222 # browser Browser used to open above URL
223 # (e.g. gc for google chrome, ff for firefox).
224 # mode Browser opening mode(e.g. headless, header).
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600225
Rahul Maheshwari79e276c2018-06-11 01:23:15 -0500226 ${browser_ID}= Run Keyword If '${mode}' == 'headless'
227 ... Launch Headless Browser ${URL} ${browser}
228 ... ELSE Open Browser ${URL} ${browser}
229
George Keishing409df052024-01-17 22:36:14 +0530230 RETURN ${browser_ID}
Sivas SRRffa42692018-01-17 05:17:35 -0600231
Rahul Maheshwari1b5369b2018-06-11 00:57:03 -0500232
Sivas SRRffa42692018-01-17 05:17:35 -0600233Controller Server Power Click Button
234 [Documentation] Click main server power in the header section.
235 [Arguments] ${controller_element}
Sathyajith M S2cdab0a2018-02-13 19:36:28 -0600236
Sivas SRRffa42692018-01-17 05:17:35 -0600237 # Description of argument(s):
238 # controller_element Server power controller element
239 # (e.g. power__power-on.)
240
Rahul Maheshwaridbbf1792018-10-31 05:36:29 -0500241 Click Element ${xpath_select_server_power}
Sivas SRRffa42692018-01-17 05:17:35 -0600242 Wait Until Element Is Visible ${controller_element}
243 Page Should Contain Button ${controller_element}
244 Click Element ${controller_element}
245
Sivas SRRffa42692018-01-17 05:17:35 -0600246
247GUI Power On
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600248 [Documentation] Power on the host using GUI.
Sivas SRRffa42692018-01-17 05:17:35 -0600249
Sivas SRRffa42692018-01-17 05:17:35 -0600250 Controller Server Power Click Button power__power-on
Anusha Dathatri7ea44c12019-09-04 09:28:38 -0500251 Wait Until Page Contains Running timeout=30s
Sivas SRRffa42692018-01-17 05:17:35 -0600252
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600253Verify Display Content
254 [Documentation] Verify text content display.
255 [Arguments] ${display_text}
256
257 # Description of argument(s):
258 # display_text The text which is expected to be found on the web page.
259
260 Page Should Contain ${display_text}
261
Sathyajith M Sf52d6fc2018-01-24 10:11:18 -0600262
263Verify Warning Message Display Text
264 [Documentation] Verify the warning message display text.
265 [Arguments] ${xpath_text_message} ${text_message}
266
267 # xpath_text_message Xpath of warning message display.
268 # text_message Content of the display message info.
269
Anusha Dathatrif93a5c42019-07-24 05:29:44 -0500270 Element Should Contain ${xpath_text_message} ${text_message}
Sivas SRRca534e62018-02-20 02:22:02 -0600271
272
273Expected Initial Test State
274 [Documentation] Power on the host if "Running" expected, Power off the
275 ... host if "Off" expected as per the requirement of initial test state.
276 [Arguments] ${expectedState}
277 # Description of argument(s):
278 # expectedState Test initial host state.
279
280 Run Keyword If '${expectedState}' == 'Running'
Rahul Maheshwari23491692018-11-09 03:42:41 -0600281 ... REST Power On stack_mode=skip quiet=1
Sivas SRRca534e62018-02-20 02:22:02 -0600282
283 Run Keyword If '${expectedState}' == 'Off'
Rahul Maheshwari23491692018-11-09 03:42:41 -0600284 ... REST Power Off stack_mode=skip quiet=1
Sivas SRR008dcc62018-02-27 06:34:56 -0600285
286Launch Browser And Login OpenBMC GUI
287 [Documentation] Launch browser and log into openbmc GUI.
288
Sridevi Rameshfba7a392025-03-27 10:21:40 -0500289 Open Browser With URL ${OPENBMC_GUI_URL}
Sivas SRR008dcc62018-02-27 06:34:56 -0600290 Login OpenBMC GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
291
292Logout And Close Browser
293 [Documentation] Logout from openbmc application and close the browser.
294
Rahul Maheshwari31b3c432020-06-26 05:24:13 -0500295 Click Button ${xpath_button_user_action}
296 Click Button ${xpath_button_logout}
Sivas SRR008dcc62018-02-27 06:34:56 -0600297 Close Browser
Rahul Maheshwarif3fa6742020-05-18 06:24:04 -0500298