1*** Settings ***
2Documentation    Stress the system using HTX exerciser.
3
4Resource         ../syslib/utils_os.robot
5Library          ../lib/gen_robot_print.py
6
7Test Setup      Pre Test Case Execution
8Test Teardown   Post Test Case Execution
9
10*** Variables ****
11
12${stack_mode}        skip
13
14# Default duration and interval of HTX exerciser to run.
15${HTX_DURATION}     2 hours
16${HTX_INTERVAL}     15 min
17
18# Default hardbootme loop times HTX exerciser to run.
19${HTX_LOOP}         4
20
21*** Test Cases ***
22
23Hard Bootme Test
24    [Documentation]  Stress the system using HTX exerciser.
25    [Tags]  Hard_Bootme_Test
26
27    Rprintn
28    Rpvars  HTX_DURATION  HTX_INTERVAL
29
30    Repeat Keyword  ${HTX_LOOP} times  Start HTX Exerciser
31
32
33*** Keywords ***
34
35Start HTX Exerciser
36    [Documentation]  Start HTX exerciser.
37    # Test Flow:
38    #              - Power on
39    #              - Establish SSH connection session
40    #              - Create HTX mdt profile
41    #              - Run HTX exerciser
42    #              - Check HTX status for errors
43    #              - Power off
44
45    Boot To OS
46
47    # Post Power off and on, the OS SSH session needs to be established.
48    Login To OS
49
50    Rprint Timen  Create HTX mdt profile.
51    ${profile}=  Execute Command On OS  htxcmdline -createmdt
52    Rprint Timen  ${profile}
53    Should Contain  ${profile}  mdts are created successfully
54
55    Rprint Timen  Start HTX mdt profile execution.
56    ${htx_run}=  Execute Command On OS  htxcmdline -run -mdt mdt.bu
57    Rprint Timen  ${htx_run}
58    Should Contain  ${htx_run}  Activated
59
60    Loop HTX Health Check
61
62    Shutdown HTX Exerciser
63
64    Power Off Host
65
66    Rprint Timen  HTX Test ran for: ${HTX_DURATION}
67
68Loop HTX Health Check
69    [Documentation]  Run until HTX exerciser fails.
70
71    Repeat Keyword  ${HTX_DURATION}
72    ...  Run Keywords  Check HTX Run Status
73    ...  AND  Sleep  ${HTX_INTERVAL}
74
75
76Check HTX Run Status
77    [Documentation]  Get HTX exerciser status and check for error.
78
79    Rprint Timen  Check HTX mdt Status and error.
80    ${status}=  Execute Command On OS  htxcmdline -status -mdt mdt.bu
81    Log  ${status}
82    Rprint Timen  ${status}
83
84    ${errlog}=  Execute Command On OS  htxcmdline -geterrlog
85    Log  ${errlog}
86    Rprint Timen  ${errlog}
87
88    Should Contain  ${errlog}  file </tmp/htxerr> is empty
89
90
91Shutdown HTX Exerciser
92    [Documentation]  Shut down HTX exerciser run.
93
94    Rprint Timen  Shutdown HTX Run
95    ${shutdown}=  Execute Command On OS  htxcmdline -shutdown -mdt mdt.bu
96    Rprint Timen  ${shutdown}
97    Should Contain  ${shutdown}  shutdown successfully
98
99
100Pre Test Case Execution
101    [Documentation]  Do the initial test setup.
102    # 1. Check if HTX tool exist.
103    # 2. Power on
104
105    Boot To OS
106    HTX Tool Exist
107
108
109Post Test Case Execution
110    [Documentation]  Do the post test teardown.
111    # 1. Shut down HTX exerciser if test Failed.
112    # 2. Capture FFDC on test failure.
113    # 3. Close all open SSH connections.
114
115    Run Keyword If  '${TEST_STATUS}' == 'FAIL'
116    ...  Shutdown HTX Exerciser
117
118    FFDC On Test Case Fail
119    Close All Connections
120
121