blob: c77bd010cf7e8869d96f130f26caaa4b04b7fd51 [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 ***
26${obmc_gui_url} http://localhost:8080/#/login
27# 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
61 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${default_browser}
62 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
69 ${BROWSER_ID}= Open Browser ${obmc_gui_url}
70 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
81 Go To ${obmc_gui_url}
82 Input Text ${xpath_textbox_hostname} ${OPENBMC_HOST}
83 Input Text ${xpath_textbox_username} ${username}
84 Input Password ${xpath_textbox_password} ${password}
85 Click Button ${xpath_button_login}
86 Wait Until Element Is Enabled ${xpath_button_logout}
87
88
89Test Setup Execution
90 [Documentation] Verify all the preconditions to be tested.
91 [Arguments] ${obmc_test_setup_state}=NONE
92 # Description of argument(s):
93 # obmc_test_setup The OpenBMC required state.
94
95 Rprint Timen ${TEST NAME} ==> [STARTED]
96 Login OpenBMC GUI
97 Log To Console Verifying the system state and stablity...
98 ${obmc_current_state}= Get Text ${xpath_display_server_power_status}
99 Rpvars obmc_current_state
100 ${obmc_state}= Run Keyword And Return Status
101 ... Should Contain ${obmc_current_state} ${obmc_test_setup_state}
102 Return From Keyword If '${obmc_state}' == 'True'
103 ${obmc_quiesced_state}= Run Keyword And Return Status
104 ... Should Contain ${obmc_current_state} ${obmc_quiesced_state}
105 Run Keyword If '${obmc_quiesced_state}' == 'True' Reboot OpenBMC
106 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerRunning_state}'
107 ... Power On OpenBMC
108 Run Keyword If '${obmc_test_setup_state}' == '${obmc_PowerOff_state}'
109 ... Power Off OpenBMC
110
111Power Off OpenBMC
112 [Documentation] Power off the OBMC system.
113
114 Log To Console Power Off OpenBMC...
115 Click Element ${xpath_display_server_power_status}
116 Execute JavaScript window.scrollTo(0, document.body.scrollHeight)
117 Click Button ${xpath_select_button_orderly_power_shutdown}
118 Click Yes Button ${xpath_select_button_orderly_power_shutdown_yes}
119 Wait OpenBMC To Become Stable ${obmc_off_state}
120
121Power On OpenBMC
122 [Documentation] Power on the OBMC system.
123
124 Log To Console Power On OpenBMC...
125 Click Element ${xpath_display_server_power_status}
126 Click Button ${xpath_select_button_power_on }
127 Wait OpenBMC To Become Stable ${obmc_running_state}
128
129Reboot OpenBMC
130 [Documentation] Rebooting the OBMC system.
131
132 Log To Console Reboting the OpenBMC...
133 Click Element ${xpath_display_server_power_status}
134 Click Button ${xpath_select_button_orderly_power_shutdown}
135 Click Yes Button ${xpath_select_button_orderly_power_shutdown_yes}
136 Wait OpenBMC To Become Stable ${obmc_off_state}
137
138Wait OpenBMC To Become Stable
139 [Documentation] Power off the OBMC.
140 [Arguments] ${OBMC_expected_state} ${retry_time}=5 min
141 ... ${retry_interval}=45 sec
142 # Description of argument(s):
143 # OBMC_expected_state The OBMC state which is required for test.
144 # retry_time Total wait time after executing the command.
145 # retry_interval Time interval for to keep checking with in the
146 # above total wait time.
147
148 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
149 ... Wait Until Element Contains ${xpath_display_server_power_status}
150 ... ${obmc_expected_state}
151 Wait Until Keyword Succeeds ${retry_time} ${retry_interval}
152 ... Verify OpenBMC State From REST Interface ${obmc_expected_state}
153
154Verify OpenBMC State From REST Interface
155 [Documentation] Verify system state from REST Interface.
156 [Arguments] ${obmc_required_state}
157 # Description of argument(s):
158 # obmc_required_state The OBMC state which is required for test.
159
160 ${obmc_current_state_REST}= Get Host State
161 Should Be Equal ${obmc_current_state_REST} ${obmc_required_state}
162
163Click Yes Button
164 [Documentation] Click the 'yes' button.
165 [Arguments] ${xpath_button_yes}
166 # Description of argument(s):
167 # xpath_button_yes The xpath of 'yes' button.
168
169 Click Button ${xpath_button_yes}
170
171LogOut OpenBMC GUI
172 [Documentation] Log out of OpenBMC GUI.
173 SSHLibrary.Close All Connections
174 click button ${xpath_button_logout}
175 Wait Until Page Contains Element ${xpath_button_login}
176
177Test Teardown Execution
178 [Documentation] Do final closure activities of test case execution.
179 Rprint Pgm Footer
180 Print Dashes 0 100 1 =
181 LogOut OpenBMC GUI