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     Launch Browser And Login GUI
13Suite Teardown  Close Browser
14Test Setup      Test Setup Execution
15
16
17*** Variables ***
18
19${xpath_overview_page_header}          //h1[contains(text(), "Overview")]
20${xpath_edit_network_settings_button}  (//*[text()="View more"])[3]
21${view_all_event_logs}                 (//*[text()="View more"])[5]
22${xpath_launch_serial_over_lan}        //*[@data-test-id='overviewQuickLinks-button-solConsole']
23${xpath_led_button}                    //*[@data-test-id='overviewInventory-checkbox-identifyLed']
24${view_all_Dumps}                      (//*[text()="View more"])[7]
25
26*** Test Cases ***
27
28Verify Existence Of All Sections In Overview Page
29    [Documentation]  Verify existence of all sections in Overview page.
30    [Tags]  Verify_Existence_Of_All_Sections_In_Overview_Page
31
32    Page Should Contain  BMC time
33    Page Should Contain  Firmware information
34    Page Should Contain  Server information
35    Wait Until Page Contains  Network information  timeout=10
36    Page Should Contain  Power information
37    Page Should Contain  Event logs
38    Page Should Contain  Inventory and LEDs
39    Page Should Contain  Dumps
40
41Verify Network Information In Overview Page
42    [Documentation]  Verify values under network information section.
43    [Tags]  Verify_Network_Information_In_Overview_Page
44
45    ${hostname}=  Get BMC Hostname
46    Page Should Contain  ${hostname}
47
48    # Get all IP addresses and prefix lengths on system.
49
50    ${ip_addr_list}=  Get BMC IP Info
51    FOR  ${ip_address}  IN  @{ip_addr_list}
52      ${ip}=  Fetch From Left  ${ip_address}  \/
53      Page Should Contain  ${ip}
54    END
55
56    ${macaddr}=  Get BMC MAC Address
57    Page Should Contain  ${macaddr}
58
59
60Verify Server Information Section
61    [Documentation]  Verify values under server information section in overview page.
62    [Tags]  Verify_Server_Information_Section
63
64    ${redfish_machine_model}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  Model
65    Page Should Contain  ${redfish_machine_model}
66
67    ${redfish_serial_number}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  SerialNumber
68    Page Should Contain  ${redfish_serial_number}
69
70    ${redfish_motherboard_manufacturer}=  Redfish.Get Attribute
71    ...  /redfish/v1/Systems/system/  Manufacturer
72
73    Page Should Contain  ${redfish_motherboard_manufacturer}
74
75
76Verify BMC Information Section
77    [Documentation]  Verify BMC information section in overview page.
78    [Tags]  Verify_BMC_Information_Section
79
80    ${firmware_version}=  Redfish Get BMC Version
81    Page Should Contain  ${firmware_version}
82
83
84Verify Edit Network Setting Button
85    [Documentation]  Verify navigation to network setting page after clicking the button in overview page.
86    [Tags]  Verify_Edit_Network_Setting_Button
87
88    Click Element  ${xpath_edit_network_settings_button}
89    Wait Until Page Contains Element  ${xpath_network_page_header}
90
91
92Verify Event Under High Priority Events Section
93    [Documentation]  Verify event under high priority events section in case of any event.
94    [Tags]  Verify_Event_Under_High_Priority_Events_Section
95
96    Redfish Purge Event Log
97    Click Element  ${xpath_refresh_button}
98    Generate Test Error Log
99    Click Element  ${xpath_refresh_button}
100    Wait Until Page Contains  xyz.openbmc_project.Common.Error.InternalFailure  timeout=30s
101
102
103Verify View All Event Logs Button
104    [Documentation]  Verify view all event log button in overview page.
105    [Tags]  Verify_View_All_Event_Logs_Button
106
107    Generate Test Error Log
108    Page Should Contain Element  ${view_all_event_logs}  timeout=30
109    Click Element  ${view_all_event_logs}
110    Wait Until Page Contains Element  ${xpath_event_header}  timeout=30
111
112
113Verify Serial Over LAN Console Button In Overview Page
114    [Documentation]  Click serial over LAN button and verify page navigation to serial over LAN page.
115    [Tags]  Verify_Serial_Over_LAN_Console_Button_In_Overview_Page
116
117    Click Element  ${xpath_launch_serial_over_lan}
118    Wait Until Page Contains Element  ${xpath_sol_console_heading}
119
120
121Verify Server LED Turn On
122    [Documentation]  Turn on server LED via GUI and verify its status via Redfish.
123    [Tags]  Verify_Server_LED_Turn_On
124
125    # Turn Off the server LED via Redfish and refresh GUI.
126    Redfish.Patch  /redfish/v1/Systems/system  body={"IndicatorLED":"Off"}   valid_status_codes=[200, 204]
127    Refresh GUI
128
129    # Turn ON the LED via GUI.
130    Click Element At Coordinates  ${xpath_led_button}  0  0
131
132    # Cross check that server LED ON state via Redfish.
133    ${led_status}=  Redfish.Get Attribute  /redfish/v1/Systems/system  IndicatorLED
134    Should Be True  '${led_status}' == 'Lit'
135
136
137Verify Server LED Turn Off
138    [Documentation]  Turn off server LED via GUI and verify its status via Redfish.
139    [Tags]  Verify_Server_LED_Turn_Off
140
141    # Turn On the server LED via Redfish and refresh GUI.
142    Redfish.Patch  /redfish/v1/Systems/system  body={"IndicatorLED":"Lit"}   valid_status_codes=[200, 204]
143    Refresh GUI
144
145    # Turn OFF the LED via GUI.
146    Click Element At Coordinates  ${xpath_led_button}  0  0
147
148    # Cross check that server LED off state via Redfish.
149    ${led_status}=  Redfish.Get Attribute  /redfish/v1/Systems/system  IndicatorLED
150    Should Be True  '${led_status}' == 'Off'
151
152
153Verify BMC Time In Overview Page
154    [Documentation]  Verify that BMC date from GUI matches with BMC time via Redfish.
155    [Tags]  Verify_BMC_Time_In_Overview_Page
156
157    ${date_time}=  Redfish.Get Attribute  ${REDFISH_BASE_URI}Managers/bmc  DateTime
158    ${converted_date}=  Convert Date  ${date_time}  result_format=%Y-%m-%d
159
160    Page Should Contain  ${converted_date}
161
162
163Verify BMC Information At Host Power Off State
164    [Documentation]  Verify that BMC information is displayed at host power off state.
165    [Tags]  Verify_BMC_Information_At_Host_Power_Off_State
166
167    Redfish Power Off  stack_mode=skip
168    ${firmware_version}=  Redfish Get BMC Version
169    Page Should Contain  ${firmware_version}
170
171
172Verify View More Button For Dumps
173    [Documentation]  Verify view more button for dumps button in overview page.
174    [Tags]  Verify_View_More_Button_For_Dumps
175
176    Wait Until Page Contains Element  ${view_all_Dumps}  timeout=30
177    Click Element  ${view_all_Dumps}
178    Wait Until Page Contains Element  ${xpath_dumps_header}   timeout=30
179
180*** Keywords ***
181
182Test Setup Execution
183    [Documentation]  Do test case setup tasks.
184
185    Click Element  ${xpath_overview_menu}
186    Wait Until Page Contains Element  ${xpath_overview_page_header}
187