1*** Settings ***
2Documentation   Module to test OS reboot functionality.
3
4Resource        ../../lib/bmc_redfish_resource.robot
5Resource        ../../lib/openbmc_ffdc.robot
6Resource        ../../lib/boot_utils.robot
7
8Suite Setup     Run Key  Start SOL Console Logging
9Test Teardown   Test Teardown Execution
10
11*** Variables ***
12
13# User defined boot test iteration.
14${BOOT_LOOP_COUNT}   ${1}
15
16*** Test Cases ***
17
18Host Reboot Loop
19    [Documentation]  Boot OS and trigger reboot and expect
20    ...              OS to boot back.
21    [Tags]  Host_Reboot_Loop
22
23    # 1. Boot OS
24    # 2. Verify OS is booted
25    # 3. Issue "reboot" from OS
26    # 4. Verify if OS is booted back
27
28    # By default run test for 1 loop, else user input iteration.
29    # Fails immediately if any of the execution rounds fail.
30
31    # Note: Host Reboot is implemented by the OBMC Boot Test tool.
32    # OBMC Boot Test will take the necessary steps to get the OBMC
33    # to a host powered on state before attempting the Host Reboot.
34    Repeat Keyword  ${BOOT_LOOP_COUNT} times  Redfish Host Reboot
35
36*** Keywords ***
37
38Test Teardown Execution
39    [Documentation]  Do the post test teardown.
40    # 1. Capture FFDC on test failure.
41    # 2. Stop SOL logging.
42    # 3. Close all open SSH connections.
43
44    FFDC On Test Case Fail
45
46    ${keyword_buf}=  Catenate  Stop SOL Console Logging
47    ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
48    Run Key  ${keyword_buf}
49
50    Close All Connections
51