1*** Settings ***
2Documentation  This test suite will validate the "OpenBMC ASMI Menu ->
3...            Server Overview" module.
4
5Resource         ../../lib/resource.robot
6Resource         ../lib/bmc_network_utils.robot
7Test Setup       Test Setup Execution  ${OBMC_PowerOff_state}
8Test Teardown    Test Teardown Execution
9
10*** Variables ***
11${xpath_select_overview_1}         //*[@href="#/overview/server"]
12${string_content}                  witherspoon
13${string_server_info}              Server information
14${string_high_priority_events}     High priority events
15${string_BMC_info}                 BMC information
16${string_power_info}               Power Consumption
17${xpath_high_priority_events}      //a[@href='#/server-health/event-log']
18${string_event_log}                Event log
19${xpath_launch_serial_over_lan}    //a[@class='no-icon quick-links__item']
20${string_launch_serial_over_lan}   Serial over LAN console
21
22*** Test Case ***
23# OpenBMC @ Power Off state test cases.
24
25Verify Serial Over LAN Button
26    [Documentation]  Verify console page on clicking serial over lan console button
27    [Tags]  Verify_Serial_Over_LAN_Button
28
29    Select Server Overview Menu
30    Click Element  ${xpath_launch_serial_over_lan}
31    Verify Display Content  Access the Serial over LAN console
32
33Verify Title Text Content At OBMC Power Off State
34    [Documentation]  Verify display of title text from "Server Overview"
35    ...  module of OpenBMC GUI.
36    [Tags]  Verify_Title_Text_Content_At_OBMC_Power_Off_State
37    ...  OBMC_PowerOff_state
38
39    Select Server Overview Menu
40    Verify Display Content  ${string_content}
41
42Verify Display Text Server Information At OBMC Power Off State
43    [Documentation]  Verify existence of text "Server information".
44    [Tags]  Verify_Display_Text_Server_Information_At_OBMC_Power_Off_State
45    ...  OBMC_PowerOff_state
46
47    Select Server Overview Menu
48    Verify Display Content  ${string_server_info}
49
50Verify BMC Information Should Display At OBMC Power Off State
51    [Documentation]  Verify existence of text "BMC information".
52    [Tags]  Verify_BMC_Information_Should_Display_At_OBMC_Power_Off_State
53    ...  OBMC_PowerOff_State
54
55    Select Server Overview Menu
56    Verify Display Content  ${string_BMC_info}
57
58Verify Power Consumption Should Display At OBMC Power Off State
59    [Documentation]  Verify existence of text "Power Consumption".
60    [Tags]  Verify_Power_Consumption_Should_Display_At_OBMC_Power_Off_State
61    ...  OBMC_PowerOff_State
62
63    Select Server Overview Menu
64    Verify Display Content  ${string_power_info}
65
66Verify High Priority Events Should Display At OBMC Power Off State
67    [Documentation]  Verify the text display.
68    [Tags]  Verify_High_Priority_Events_Should_Display_At_OBMC_Power_Off_State
69    ...  OBMC_PowerOff_State
70
71    Select Server Overview Menu
72    Verify Display Content  ${string_high_priority_events}
73
74Verify High Priority Events Can Be Operated At OBMC Power Off State
75    [Documentation]  Will open the "High Priority Events".
76    ...  menu to view and operate.
77    [Tags]  Verify_High_Priority_Events_Can_Be_Operated_At_OBMC_Power_Off_State
78    ...   OBMC_PowerOff_state
79
80    Select Server Overview Menu
81    Click Link  ${xpath_high_priority_events}
82    Verify Display Content  ${string_event_log}
83
84Verify Launching Of Serial Over LAN Console At OBMC Power Off State
85    [Documentation]  Will open the serial over the lan command prompt window.
86    [Tags]  Verify_Launching_Of_Serial_Over_LAN_Console_At_OBMC_Power_Off_State
87    ...  OBMC_PowerOff_State
88
89    Select Server Overview Menu
90    Click Element  ${xpath_launch_serial_over_lan}
91    Verify Display Content  ${string_launch_serial_over_lan}
92
93
94# OpenBMC @ Power Running state test cases.
95
96Verify BMC Information
97    [Documentation]  Get BMC hostname, version, IP, and MAC address via GUI and verify using REST
98    [Tags]  Verify_BMC_Information
99
100    Select Server Overview Menu
101
102    ${hostname}=  Get BMC Hostname
103    ${hostname}=  Remove String  ${hostname}  '
104    ${hostname}=  Fetch From Right  ${hostname}  :
105    Verify Display Content  ${hostname}
106
107    ${version}=  Get BMC Version
108    ${version}=  Remove String  ${version}  "
109    Verify Display Content  ${version}
110
111    ${iplist}=  Get BMC IP Info
112    FOR  ${ip}  IN  @{iplist}
113      ${ip}=  Fetch From Left  ${ip}  /
114      Verify Display Content  ${ip}
115    END
116
117    ${mac}=  Get BMC MAC Address
118    Verify Display Content  ${mac}
119
120Verify High Priority Events Can Be Operated At OBMC Power Running State
121    [Documentation]  Will open the "High Priority Events"
122    ...  menu to view and operate.
123    [Tags]  Verify_High_Priority_Events_Can_Be_Operated_At_OBMC_Power_Running_State
124    ...  OBMC_PowerRunning_state
125    [Setup]  Test Setup Execution  ${OBMC_PowerRunning_state}
126
127    Select Server Overview Menu
128    Click Link  ${xpath_high_priority_events}
129    Verify Display Content  ${string_event_log}
130
131Verify Launching Of Serial Over LAN Console At OBMC Power Running State
132    [Documentation]  Will open the serial over the lan command prompt window.
133    [Tags]  Verify_Launching_Of_Serial_Over_LAN_Console_At_OBMC_Power_Running_State
134    ...  OBMC_PowerRunning_State
135    [Setup]  Test Setup Execution  ${OBMC_PowerRunning_state}
136
137    Select Server Overview Menu
138    Click Element  ${xpath_launch_serial_over_lan}
139    Verify Display Content  ${string_launch_serial_over_lan}
140
141*** Keywords ***
142Select Server Overview Menu
143    [Documentation]  Selecting of OpenBMC "Server overview" menu.
144
145    Click Element  ${xpath_select_overview_1}
146    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
147    Page Should Contain  Server information
148
149Verify Display Content
150    [Documentation]  Verify text content display.
151    [Arguments]  ${display_text}
152    # Description of argument(s):
153    # display_text   The display text on web page.
154
155    Page Should Contain  ${display_text}
156