xref: /openbmc/openbmc-test-automation/gui/gui_test/overview_menu/test_overview_menu.robot (revision 025063e5276721ce64b872bc18df6ce96cb8aa95)
1*** Settings ***
2
3Documentation  Test OpenBMC GUI "Overview" menu.
4
5Resource        ../../lib/gui_resource.robot
6Resource        ../../../lib/logging_utils.robot
7Resource        ../../../lib/list_utils.robot
8Resource        ../../../lib/bmc_network_utils.robot
9
10Library         String
11
12Suite Setup     Run Keywords  Launch Browser And Login GUI  AND  Redfish.Login
13Suite Teardown  Run Keywords  Close Browser  AND  Redfish.Logout
14Test Setup      Test Setup Execution
15
16Test Tags      Overview_Menu
17
18*** Variables ***
19
20${xpath_overview_page_header}                    //h1[contains(text(), "Overview")]
21${xpath_server_information_view_more_button}     (//*[text()="View more"])[1]
22${xpath_firmware_information_view_more_button}   (//*[text()="View more"])[2]
23${xpath_network_information_view_more_button}    (//*[text()="View more"])[3]
24${xpath_power_information_view_more_button}      (//*[text()="View more"])[4]
25${xpath_event_logs_view_more_button}             (//*[text()="View more"])[5]
26${xpath_inventory_and_leds_view_more_button}     (//*[text()="View more"])[6]
27${xpath_launch_host_console}                     //*[@data-test-id='overviewQuickLinks-button-solConsole']
28${xpath_led_button}                              //*[@for="identifyLedSwitch"]
29${xpath_dumps_view_more_button}                  (//*[text()="View more"])[7]
30${xpath_critical_logs_count}                     //dt[contains(text(),'Critical')]/following-sibling::dd[1]
31${xpath_warning_logs_count}                      //dt[contains(text(),'Warning')]/following-sibling::dd[1]
32${xpath_asset_tag}                               //dt[contains(text(),'Asset tag')]/following-sibling::dd[1]
33${xpath_operating_mode}                          //dt[contains(text(),'Operating mode')]/following-sibling::dd[1]
34${xpath_machine_model}                           //dt[contains(text(),'Model')]/following-sibling::dd[1]
35${xpath_serial_number}                           //dt[contains(text(),'Serial number')]/following-sibling::dd[1]
36
37*** Test Cases ***
38
39Verify Existence Of All Sections In Overview Page
40    [Documentation]  Verify existence of all sections in Overview page.
41    [Tags]  Verify_Existence_Of_All_Sections_In_Overview_Page
42
43    Page Should Contain  BMC date and time
44    Page Should Contain  Firmware information
45    Page Should Contain  Server information
46    Wait Until Page Contains  Network information  timeout=10
47    Page Should Contain  Power information
48    Page Should Contain  Event logs
49    Page Should Contain  Inventory and LEDs
50    Page Should Contain  Dumps
51
52
53Verify Network Information In Overview Page
54    [Documentation]  Verify values under network information section.
55    [Tags]  Verify_Network_Information_In_Overview_Page
56
57    ${hostname}=  Get BMC Hostname
58    Page Should Contain  ${hostname}
59
60    # Get all IP addresses and prefix lengths on system.
61
62    ${resp}=  Redfish.Get Attribute  /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0  IPv4StaticAddresses
63    ${ip_addr}=  Set Variable  ${resp[0]['Address']}
64    Page Should Contain  ${ip_addr}
65
66
67Verify Server Information Section
68    [Documentation]  Verify values under server information section in overview page.
69    [Tags]  Verify_Server_Information_Section
70
71    # Model.
72    ${redfish_machine_model}=  Redfish.Get Attribute  ${SYSTEM_BASE_URI}  Model
73    Element Should Contain  ${xpath_machine_model}  ${redfish_machine_model}
74
75    # Serial Number.
76    ${redfish_serial_number}=  Redfish.Get Attribute  ${SYSTEM_BASE_URI}  SerialNumber
77    Element Should Contain  ${xpath_serial_number}  ${redfish_serial_number}
78
79    # Asset Tag.
80    ${redfish_asset_tag}=  Redfish.Get Attribute  ${SYSTEM_BASE_URI}  AssetTag
81    Element Should Contain  ${xpath_asset_tag}  ${redfish_asset_tag}
82
83    # Operating mode.
84    ${redfish_operating_mode}=  Redfish.Get Attribute  ${BIOS_ATTR_URI}  Attributes
85    Element Should Contain  ${xpath_operating_mode}  ${redfish_operating_mode['pvm_system_operating_mode']}
86
87
88Verify BMC Information Section
89    [Documentation]  Verify BMC information section in overview page.
90    [Tags]  Verify_BMC_Information_Section
91
92    ${firmware_version}=  Redfish Get BMC Version
93    Page Should Contain  ${firmware_version}
94
95
96Verify Edit Network Setting Button
97    [Documentation]  Verify navigation to network setting page after clicking the button in overview page.
98    [Tags]  Verify_Edit_Network_Setting_Button
99
100    Click Element  ${xpath_network_information_view_more_button}
101    Wait Until Page Contains Element  ${xpath_network_heading}
102
103
104Verify Event Under Critical Event Logs Section
105    [Documentation]  Verify event under critical event logs section in case of any event.
106    [Tags]  Verify_Event_Under_Critical_Event_Logs_Section
107    [Teardown]  Redfish Purge Event Log
108
109    Redfish Purge Event Log
110    Click Element  ${xpath_refresh_button}
111    Generate Test Error Log
112    Click Element  ${xpath_refresh_button}
113    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
114    ${log_count}=  Get Text  ${xpath_critical_logs_count}
115    Should Be True  '${log_count}' == '${1}'
116
117
118Verify Event Under Warning Event Logs Section
119    [Documentation]  Verify event under warning event logs section in case of any event.
120    [Tags]  Verify_Event_Under_Warning_Event_Logs_Section
121    [Teardown]  Redfish Purge Event Log
122
123    Redfish Purge Event Log
124    Click Element  ${xpath_refresh_button}
125
126    # Generate a predictable error for testing purpose.
127    BMC Execute Command  ${CMD_PREDICTIVE_ERROR}
128
129    Click Element  ${xpath_refresh_button}
130    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
131
132    ${log_count}=  Get Text  ${xpath_warning_logs_count}
133    Should Be Equal As Integers  ${log_count}  1
134
135
136Verify View More Event Logs Button
137    [Documentation]  Verify view more event log button in overview page.
138    [Tags]  Verify_View_More_Event_Logs_Button
139
140    Generate Test Error Log
141    Page Should Contain Element  ${xpath_event_logs_view_more_button}  timeout=30
142    Click Element  ${xpath_event_logs_view_more_button}
143    Wait Until Page Contains Element  ${xpath_event_logs_heading}  timeout=30
144
145
146Verify Host Console Button In Overview Page
147    [Documentation]  Click host console button and verify page navigation to host console page.
148    [Tags]  Verify_Host_Console_Button_In_Overview_Page
149
150    Click Element  ${xpath_launch_host_console}
151    Wait Until Page Contains Element  ${xpath_host_console_heading}
152
153
154Verify Server LED Turn On
155    [Documentation]  Turn on server LED via GUI and verify its status via Redfish.
156    [Tags]  Verify_Server_LED_Turn_On
157
158    # Turn Off the server LED via Redfish and refresh GUI.
159    Set IndicatorLED State  Off
160    Refresh GUI
161
162    # Turn ON the LED via GUI.
163    Click Element  ${xpath_led_button}
164
165    # Cross check that server LED ON state via Redfish.
166    Verify Identify LED State Via Redfish  Lit
167
168
169Verify Server LED Turn Off
170    [Documentation]  Turn off server LED via GUI and verify its status via Redfish.
171    [Tags]  Verify_Server_LED_Turn_Off
172
173    # Turn On the server LED via Redfish and refresh GUI.
174    Set IndicatorLED State  Lit
175    Refresh GUI
176
177    # Turn OFF the LED via GUI.
178    Click Element  ${xpath_led_button}
179
180    # Cross check that server LED off state via Redfish.
181    Verify Identify LED State Via Redfish  Off
182
183
184Verify BMC Time In Overview Page
185    [Documentation]  Verify that BMC date from GUI matches with BMC time via Redfish.
186    [Tags]  Verify_BMC_Time_In_Overview_Page
187
188    ${date_time}=  Redfish.Get Attribute  ${REDFISH_BASE_URI}Managers/${MANAGER_ID}  DateTime
189    ${converted_date}=  Convert Date  ${date_time}  result_format=%Y-%m-%d
190
191    Page Should Contain  ${converted_date}
192
193
194Verify View More Button For Dumps
195    [Documentation]  Verify view more button for dumps button in overview page.
196    [Tags]  Verify_View_More_Button_For_Dumps
197
198    Wait Until Page Contains Element  ${xpath_dumps_view_more_button}  timeout=30
199    Click Element  ${xpath_dumps_view_more_button}
200    Wait Until Page Contains Element  ${xpath_dumps_header}  timeout=30
201
202
203Verify View More Button Under Server Information Section
204    [Documentation]  Verify view more button under server information section in overview page.
205    [Tags]  Verify_View_More_Button_Under_Server_Information_Section
206
207    Wait Until Page Contains Element  ${xpath_server_information_view_more_button}  timeout=30
208    Click Element   ${xpath_server_information_view_more_button}
209    Wait Until Page Contains Element  ${xpath_inventory_and_leds_heading}  timeout=30
210
211
212Verify View More Button Under Firmware Information Section
213    [Documentation]  Verify view more button under firmware information section in overview page.
214    [Tags]  Verify_View_More_Button_Under_Firmware_Information_Section
215
216    Wait Until Page Contains Element  ${xpath_firmware_information_view_more_button}  timeout=30
217    Click Element  ${xpath_firmware_information_view_more_button}
218    Wait Until Page Contains Element  ${xpath_firmware_heading}  timeout=30
219
220
221Verify View More Button Under Network Information Section
222    [Documentation]  Verify view more button under network information section in overview page.
223    [Tags]  Verify_View_More_Button_Under_Network_Information_Section
224
225    Wait Until Page Contains Element  ${xpath_network_information_view_more_button}  timeout=30
226    Click Element  ${xpath_network_information_view_more_button}
227    Wait Until Page Contains Element  ${xpath_network_heading}  timeout=30
228
229
230Verify View More Button Under Power Information Section
231    [Documentation]  Verify view more button under power information section in overview page.
232    [Tags]  Verify_View_More_Button_Under_Power_Information_Section
233
234    Wait Until Page Contains Element  ${xpath_power_information_view_more_button}  timeout=30
235    Click Element  ${xpath_power_information_view_more_button}
236    Wait Until Page Contains Element  ${xpath_power_heading}  timeout=30
237
238
239Verify View More Button Under Event Logs Section
240    [Documentation]  Verify view more button under event logs section in overview page.
241    [Tags]  Verify_View_More_Button_Under_Event_Logs_Section
242
243    Wait Until Page Contains Element  ${xpath_event_logs_view_more_button}  timeout=30
244    Click Element  ${xpath_event_logs_view_more_button}
245    Wait Until Page Contains Element  ${xpath_event_logs_heading}  timeout=30
246
247
248Verify View More Button Under Inventory And LEDs Section
249    [Documentation]  Verify view more button under inventory and leds section in overview page.
250    [Tags]  Verify_View_More_Button_Under_Inventory_And_LEDs_Section
251
252    Wait Until Page Contains Element  ${xpath_inventory_and_leds_view_more_button}  timeout=30
253    Click Element  ${xpath_inventory_and_leds_view_more_button}
254    Wait Until Page Contains Element  ${xpath_inventory_and_leds_heading}  timeout=30
255
256
257Verify Text Under Server Information Section
258    [Documentation]  Verify text under server information section in overview page.
259    [Tags]  Verify_Text_Under_Server_Information_Section
260
261    Page Should Contain  Model
262    Page Should Contain  Operating mode
263    Page Should Contain  Serial number
264    Page Should Contain  Service login
265    Page Should Contain  Asset tag
266
267
268Verify Text Under Firmware Information Section
269    [Documentation]  Verify text under firmware information section in overview page.
270    [Tags]  Verify_Text_Under_Firmware_Information_Section
271
272    Page Should Contain  Running
273    Page Should Contain  Backup
274    Page Should Contain  Access key expiration
275
276
277Verify Text Under Network Information Section
278    [Documentation]  Verify text under network information section in overview page.
279    [Tags]  Verify_Text_Under_Network_Information_Section
280
281    Page Should Contain  Hostname
282    Page Should Contain  IPv4
283    Page Should Contain  DHCPv4
284
285
286Verify Text Under Power Information Section
287    [Documentation]  Verify text under power information section in overview page.
288    [Tags]  Verify_Text_Under_Power_Information_Section
289
290    Page Should Contain  Power consumption
291    Page Should Contain  Idle power saver
292    Page Should Contain  Power cap
293    Page Should Contain  Power mode
294
295
296Verify Text Under Event Logs Section
297    [Documentation]  Verify text under event logs section in overview page.
298    [Tags]  Verify_Text_Under_Event_Logs_Section
299
300    Page Should Contain  Critical
301    Page Should Contain  Warning
302
303
304Verify Text Under Inventory And LEDs Section
305    [Documentation]  Verify text under inventory and leds section in overview page.
306    [Tags]  Verify_Text_Under_Inventory_And_LEDs_Section
307
308    Page Should Contain  System identify LED
309
310
311Verify Text Under Dumps Section
312    [Documentation]  Verify text under Dumps section in overview page.
313    [Tags]  Verify_Text_Under_Dumps_Section
314
315    Page Should Contain  Total
316
317
318Verify Server LED Turn Off And On With Readonly User
319    [Documentation]  Turn off and on server LED via GUI with Readonly user.
320    [Tags]  Verify_Server_LED_Turn_Off_And_On_With_Readonly_User
321    [Setup]  Create Readonly User And Login To GUI
322    [Teardown]  Delete Readonly User And Logout Current GUI Session
323
324    # Turn On the server LED via Redfish and refresh GUI.
325    Set IndicatorLED State  Lit
326    Refresh GUI
327
328    # Turn OFF the LED via GUI.
329    Click Element  ${xpath_led_button}
330    Verify Error And Unauthorized Message On GUI
331
332    # Turn ON the LED via GUI.
333    Set IndicatorLED State   Off
334    Refresh GUI
335    Click Element  ${xpath_led_button}
336    Verify Error And Unauthorized Message On GUI
337
338
339***  Power Off Test Cases  ***
340
341    Verify BMC Information At Host Power Off State
342    [Documentation]  Verify that BMC information is displayed at host power off state.
343    [Tags]  Verify_BMC_Information_At_Host_Power_Off_State
344    [Setup]  Run Keywords  Power On Server  AND  Test Setup Execution
345
346    ${firmware_version}=  Redfish Get BMC Version
347    Page Should Contain  ${firmware_version}
348
349
350*** Keywords ***
351
352Test Setup Execution
353    [Documentation]  Do test case setup tasks.
354
355    Click Element  ${xpath_overview_menu}
356    Wait Until Page Contains Element  ${xpath_overview_page_header}
357    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=30
358
359
360Verify Identify LED State Via Redfish
361    [Documentation]  Verify that Redfish identify LED system with given state.
362    [Arguments]  ${expected_state}
363
364    # Description of argument(s):
365    # expected_state    Expected value of Identify LED.
366
367    ${led_state}=  Redfish.Get Attribute  /redfish/v1/Systems/${SYSTEM_ID}  IndicatorLED
368    Should Be True  '${led_state}' == '${expected_state}'
369
370Set IndicatorLED State
371    [Documentation]  Perform redfish PATCH operation.
372    [Arguments]  ${led_state}  ${expect_resp_code}=[200, 204]
373
374    # Description of argument(s):
375    # led_state            IndicatorLED state to "off", "Lit" etc.
376    # expect_resp_code     Expected HTTPS response code. Default [200, 204]
377
378
379    Redfish.Patch  /redfish/v1/Systems/${SYSTEM_ID}  body={"IndicatorLED": "${led_state}"}
380    ...  valid_status_codes=${expect_resp_code}
381
382