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