xref: /openbmc/openbmc-test-automation/redfish/extended/test_basic_ci.robot (revision 94041a34a992d9b5f6418a43e1cd5273a6d9f9b2)
1*** Settings ***
2Documentation  Test for HW CI.
3
4Library             DateTime
5
6Resource            ../../lib/utils.robot
7Resource            ../../lib/ipmi_client.robot
8Resource            ../../lib/boot_utils.robot
9Resource            ../../lib/openbmc_ffdc.robot
10Resource            ../../lib/bmc_redfish_resource.robot
11
12Test Setup          Test Setup Execution
13Test Teardown       FFDC On Test Case Fail
14
15Test Tags           Basic_CI
16
17*** Variables ***
18
19# Error strings to check from journald.
20${ERROR_REGEX}     SEGV|core-dump|FAILURE|Failed to start|Found ordering cycle
21${STANDBY_REGEX}   Startup finished in
22
23${SKIP_ERROR}      ${EMPTY}
24
25# 3 minutes standby boot time.
26${startup_time_threshold}  180
27
28*** Test Cases ***
29
30Verify Application Services Running At Standby
31    [Documentation]  Check if there are services that have not completed.
32    [Tags]  Verify_Application_Services_Running_At_Standby
33
34    # Application services running on the BMC are not tightly coupled.
35    # At standby, there shouldn't be any pending job waiting to complete.
36    # Examples:
37    # Failure o/p:
38    # root@witherspoon:~# systemctl list-jobs --no-pager | cat
39    #    JOB UNIT                                     TYPE  STATE
40    # 35151 xyz.openbmc_project.ObjectMapper.service start running
41    # 1 jobs listed.
42    #
43    # Success o/p:
44    # root@witherspoon:~# systemctl list-jobs --no-pager | cat
45    # No jobs running.
46
47    Redfish Hard Power Off
48    ${stdout}  ${stderr}  ${rc}=  BMC Execute Command
49    ...  systemctl list-jobs --no-pager | cat
50    Should Be Equal As Strings  ${stdout}  No jobs running.
51
52
53Verify Front And Rear LED At Standby
54    [Documentation]  Front and Rear LED should be off at standby.
55    [Tags]  Verify_Front_And_Rear_LED_At_Standby
56
57    Redfish Power Off  stack_mode=skip  quiet=1
58    Verify Identify LED State  ${0}
59
60
61Check For Application Failures
62    [Documentation]  Parse the journal log and check for failures.
63    [Tags]  Check_For_Application_Failures
64
65    Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b  filter_string=${SKIP_ERROR}
66
67
68Verify Uptime Average Against Threshold
69    [Documentation]  Compare BMC average boot time to a constant threshold.
70    [Tags]  Verify_Uptime_Average_Against_Threshold
71
72    Redfish OBMC Reboot (off)
73
74    Wait Until Keyword Succeeds
75    ...  1 min  30 sec  Check BMC Uptime Journald
76
77
78Test SSH And IPMI Connections
79    [Documentation]  Try SSH and IPMI commands to verify each connection.
80    [Tags]  Test_SSH_And_IPMI_Connections
81
82    BMC Execute Command  true
83    Run IPMI Standard Command  chassis status
84
85
86*** Keywords ***
87
88Test Setup Execution
89   [Documentation]  Do test case setup tasks.
90
91   Printn
92   Redfish.Login
93
94
95Check BMC Uptime Journald
96    [Documentation]  Check BMC journald uptime entry.
97
98    # Example output:
99    # Startup finished in 10.074s (kernel) + 2min 23.506s (userspace) = 2min 33.581s.
100    ${startup_time}  ${stderr}  ${rc}=  BMC Execute Command
101    ...  journalctl --no-pager | egrep '${STANDBY_REGEX}' | tail -1
102    Should Not Be Empty  ${startup_time}
103
104    # Example time conversion:
105    # Get the "2min 33.581s" string total time taken to reach standby.
106    # Convert time "2min 33.581s" to unit 153.581.
107    ${startup_time}=  Convert Time  ${startup_time.split("= ",1)[1].strip(".")}
108
109    Should Be True  ${startup_time} < ${startup_time_threshold}
110    ...  msg=${startup_time} greater than threshold value of ${startup_time_threshold}.
111