xref: /openbmc/openbmc-test-automation/redfish/extended/test_basic_ci.robot (revision c79341b531aadc42a865767fde9877065d591b70)
176a484a5SGeorge Keishing*** Settings ***
276a484a5SGeorge KeishingDocumentation  Test for HW CI.
376a484a5SGeorge Keishing
476a484a5SGeorge KeishingLibrary             DateTime
576a484a5SGeorge Keishing
676a484a5SGeorge KeishingResource            ../../lib/utils.robot
776a484a5SGeorge KeishingResource            ../../lib/ipmi_client.robot
876a484a5SGeorge KeishingResource            ../../lib/boot_utils.robot
976a484a5SGeorge KeishingResource            ../../lib/openbmc_ffdc.robot
1076a484a5SGeorge KeishingResource            ../../lib/bmc_redfish_resource.robot
1176a484a5SGeorge Keishing
122997a28cSGeorge KeishingTest Setup          Test Setup Execution
1376a484a5SGeorge KeishingTest Teardown       FFDC On Test Case Fail
1476a484a5SGeorge Keishing
1576a484a5SGeorge Keishing*** Variables ***
1676a484a5SGeorge Keishing
1776a484a5SGeorge Keishing# Error strings to check from journald.
18*c79341b5SJian Zhang${ERROR_REGEX}     SEGV|core-dump|FAILURE|Failed to start|Found ordering cycle
1976a484a5SGeorge Keishing${STANDBY_REGEX}   Startup finished in
2076a484a5SGeorge Keishing
21140351fcSGeorge Keishing${SKIP_ERROR}      ${EMPTY}
22140351fcSGeorge Keishing
2376a484a5SGeorge Keishing# 3 minutes standby boot time.
2476a484a5SGeorge Keishing${startup_time_threshold}  180
2576a484a5SGeorge Keishing
2676a484a5SGeorge Keishing*** Test Cases ***
2776a484a5SGeorge Keishing
2876a484a5SGeorge KeishingVerify Application Services Running At Standby
2976a484a5SGeorge Keishing    [Documentation]  Check if there are services that have not completed.
3076a484a5SGeorge Keishing    [Tags]  Verify_Application_Services_Running_At_Standby
3176a484a5SGeorge Keishing
3276a484a5SGeorge Keishing    # Application services running on the BMC are not tightly coupled.
3376a484a5SGeorge Keishing    # At standby, there shouldn't be any pending job waiting to complete.
3476a484a5SGeorge Keishing    # Examples:
3576a484a5SGeorge Keishing    # Failure o/p:
3676a484a5SGeorge Keishing    # root@witherspoon:~# systemctl list-jobs --no-pager | cat
3776a484a5SGeorge Keishing    #    JOB UNIT                                     TYPE  STATE
3876a484a5SGeorge Keishing    # 35151 xyz.openbmc_project.ObjectMapper.service start running
3976a484a5SGeorge Keishing    # 1 jobs listed.
4076a484a5SGeorge Keishing    #
4176a484a5SGeorge Keishing    # Success o/p:
4276a484a5SGeorge Keishing    # root@witherspoon:~# systemctl list-jobs --no-pager | cat
4376a484a5SGeorge Keishing    # No jobs running.
4476a484a5SGeorge Keishing
4576a484a5SGeorge Keishing    Redfish Hard Power Off
4676a484a5SGeorge Keishing    ${stdout}  ${stderr}  ${rc}=  BMC Execute Command
4776a484a5SGeorge Keishing    ...  systemctl list-jobs --no-pager | cat
4876a484a5SGeorge Keishing    Should Be Equal As Strings  ${stdout}  No jobs running.
4976a484a5SGeorge Keishing
5076a484a5SGeorge Keishing
5176a484a5SGeorge KeishingVerify Front And Rear LED At Standby
5276a484a5SGeorge Keishing    [Documentation]  Front and Rear LED should be off at standby.
5376a484a5SGeorge Keishing    [Tags]  Verify_Front_And_Rear_LED_At_Standby
5476a484a5SGeorge Keishing
5576a484a5SGeorge Keishing    Redfish Power Off  stack_mode=skip  quiet=1
5676a484a5SGeorge Keishing    Verify Identify LED State  ${0}
5776a484a5SGeorge Keishing
5876a484a5SGeorge Keishing
5976a484a5SGeorge KeishingCheck For Application Failures
6076a484a5SGeorge Keishing    [Documentation]  Parse the journal log and check for failures.
6176a484a5SGeorge Keishing    [Tags]  Check_For_Application_Failures
6276a484a5SGeorge Keishing
63140351fcSGeorge Keishing    Check For Regex In Journald  ${ERROR_REGEX}  error_check=${0}  boot=-b  filter_string=${SKIP_ERROR}
6476a484a5SGeorge Keishing
6576a484a5SGeorge Keishing
6676a484a5SGeorge KeishingVerify Uptime Average Against Threshold
6776a484a5SGeorge Keishing    [Documentation]  Compare BMC average boot time to a constant threshold.
6876a484a5SGeorge Keishing    [Tags]  Verify_Uptime_Average_Against_Threshold
6976a484a5SGeorge Keishing
7076a484a5SGeorge Keishing    Redfish OBMC Reboot (off)
7176a484a5SGeorge Keishing
7276a484a5SGeorge Keishing    Wait Until Keyword Succeeds
7376a484a5SGeorge Keishing    ...  1 min  30 sec  Check BMC Uptime Journald
7476a484a5SGeorge Keishing
7576a484a5SGeorge Keishing
7676a484a5SGeorge KeishingTest SSH And IPMI Connections
7776a484a5SGeorge Keishing    [Documentation]  Try SSH and IPMI commands to verify each connection.
7876a484a5SGeorge Keishing    [Tags]  Test_SSH_And_IPMI_Connections
7976a484a5SGeorge Keishing
8076a484a5SGeorge Keishing    BMC Execute Command  true
8176a484a5SGeorge Keishing    Run IPMI Standard Command  chassis status
8276a484a5SGeorge Keishing
8376a484a5SGeorge Keishing
8476a484a5SGeorge Keishing*** Keywords ***
8576a484a5SGeorge Keishing
862997a28cSGeorge KeishingTest Setup Execution
872997a28cSGeorge Keishing   [Documentation]  Do test case setup tasks.
882997a28cSGeorge Keishing
892997a28cSGeorge Keishing   Printn
902997a28cSGeorge Keishing   Redfish.Login
912997a28cSGeorge Keishing
922997a28cSGeorge Keishing
9376a484a5SGeorge KeishingCheck BMC Uptime Journald
9476a484a5SGeorge Keishing    [Documentation]  Check BMC journald uptime entry.
9576a484a5SGeorge Keishing
9676a484a5SGeorge Keishing    # Example output:
9776a484a5SGeorge Keishing    # Startup finished in 10.074s (kernel) + 2min 23.506s (userspace) = 2min 33.581s.
9876a484a5SGeorge Keishing    ${startup_time}  ${stderr}  ${rc}=  BMC Execute Command
9976a484a5SGeorge Keishing    ...  journalctl --no-pager | egrep '${STANDBY_REGEX}' | tail -1
10076a484a5SGeorge Keishing    Should Not Be Empty  ${startup_time}
10176a484a5SGeorge Keishing
10276a484a5SGeorge Keishing    # Example time conversion:
10376a484a5SGeorge Keishing    # Get the "2min 33.581s" string total time taken to reach standby.
10476a484a5SGeorge Keishing    # Convert time "2min 33.581s" to unit 153.581.
10576a484a5SGeorge Keishing    ${startup_time}=  Convert Time  ${startup_time.split("= ",1)[1].strip(".")}
10676a484a5SGeorge Keishing
10776a484a5SGeorge Keishing    Should Be True  ${startup_time} < ${startup_time_threshold}
10876a484a5SGeorge Keishing    ...  msg=${startup_time} greater than threshold value of ${startup_time_threshold}.
109