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