1*** Settings ***
2
3Documentation    Test Redfish session and its connection stability.
4
5Resource         ../../lib/bmc_redfish_utils.robot
6Resource         ../../lib/openbmc_ffdc.robot
7
8Suite Setup      Disable Redfish Delete Session
9Suite Teardown   Run Keywords  Enable Redfish Delete Session  AND  Redfish.Logout
10Test Setup       Printn
11Test Teardown    FFDC On Test Case Fail
12
13
14*** Variables ***
15
16${duration}                 6h
17${interval}                 30s
18${reboot_interval}          30m
19${REDFISH_DELETE_SESSIONS}  ${0}
20
21
22*** Test Cases ***
23
24Create Session And Check Connection Stability
25    [Documentation]  Send heartbeat on session continuously and verify connection stability.
26    [Tags]  Create_Session_And_Check_Connection_Stability
27    [Setup]  Redfish.logout
28
29    # Clear old session and start new session.
30    Redfish.Login
31
32    Repeat Keyword  ${duration}  Send Heartbeat
33
34
35Create Session And Check Connection Stability On Reboot
36    [Documentation]  Create Session And Check Connection Stability On Reboot
37    [Tags]  Create_Session_And_Check_Connection_Stability_On_Reboot
38    [Setup]  Redfish.logout
39
40    # Clear old session and start new session.
41    Redfish.Login
42
43    Repeat Keyword  ${duration}  Check Connection On Reboot
44
45
46*** Keywords ***
47
48Send Heartbeat
49    [Documentation]  Send heartbeat to BMC.
50
51    ${hostname}=  Redfish.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
52    Sleep  ${interval}
53
54
55Check Connection On Reboot
56    [Documentation]  Send heartbeat on BMC reboot.
57
58    # Reboot BMC
59    Redfish OBMC Reboot (Off)
60
61    # Verify session is still active and no issues on connection after reboot.
62    Repeat Keyword  ${reboot_interval}  Send Heartbeat
63
64Disable Redfish Delete Session
65    [Documentation]  Disable delete redfish while performing power operation keyword.
66
67    ${REDFISH_DELETE_SESSIONS}=  Set Variable  ${0}
68    Set Suite Variable  ${REDFISH_DELETE_SESSIONS}
69
70Enable Redfish Delete Session
71    [Documentation]  Enable delete redfish while performing power operation keyword.
72
73    ${REDFISH_DELETE_SESSIONS}=  Set Variable  ${1}
74    Set Suite Variable  ${REDFISH_DELETE_SESSIONS}