blob: 60f8344a73afb50b13900c9af657cb8208be3d6d [file] [log] [blame]
Peter D Phan028b8fd2022-04-19 11:20:28 -05001*** Settings ***
2
3Documentation Stress the system using HTX exerciser - bootme option.
4
5# Test Parameters:
6# OPENBMC_HOST The BMC host name or IP address.
7# OS_HOST The OS host name or IP Address.
8# OS_USERNAME The OS login userid (usually root).
9# OS_PASSWORD The password for the OS login.
10# HTX_DURATION Duration of HTX run, for example, 2h, or 30m.
11# HTX_LOOP The number of times to loop HTX.
12
13
Peter D Phan028b8fd2022-04-19 11:20:28 -050014Resource ../syslib/resource.robot
George Keishing343c95f2022-08-22 23:12:05 -050015Resource ../syslib/utils_os.robot
Peter D Phan028b8fd2022-04-19 11:20:28 -050016Library ../syslib/utils_keywords.py
George Keishing343c95f2022-08-22 23:12:05 -050017Resource ../lib/openbmc_ffdc_utils.robot
Peter D Phan028b8fd2022-04-19 11:20:28 -050018Library ../syslib/utils_os.py
19Library DateTime
20
George Keishing343c95f2022-08-22 23:12:05 -050021Suite Setup Start SOL Console Logging
Peter D Phan028b8fd2022-04-19 11:20:28 -050022Test Setup Test Setup Execution
23Test Teardown Test Teardown Execution
24
Peter D Phan028b8fd2022-04-19 11:20:28 -050025*** Variables ****
26
Peter D Phan028b8fd2022-04-19 11:20:28 -050027${rest_keyword} REST
28
Peter D Phan028b8fd2022-04-19 11:20:28 -050029*** Test Cases ***
30
31Soft Bootme Test
32 [Documentation] Using HTX exerciser soft boot option.
33 [Tags] Soft_Bootme_Test
34
35 Printn
36 Rprint Vars HTX_DURATION HTX_LOOP
37
38 # Set up the (soft) bootme iteration (loop) counter.
39 Set Suite Variable ${iteration} ${0} children=true
40
41 # Run test
42 Repeat Keyword ${HTX_LOOP} times Run HTX Soft Bootme Exerciser
43
44
45*** Keywords ***
46
47
48Run HTX Soft Bootme Exerciser
49 [Documentation] Run HTX Soft Bootme Exerciser.
50 # Test Flow:
51 # - Power on.
52 # - Create HTX mdt profile.
53 # - Run HTX exerciser.
54 # - Soft bootme (OS Reboot).
55 # - Check HTX status for errors.
56
57 ${runtime}= Convert Time ${HTX_DURATION}
58
59 ${startTime} = Get Current Date
60 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
61 ... Create Default MDT Profile
62
63 Run MDT Profile
George Keishing343c95f2022-08-22 23:12:05 -050064
65 # **********************************
66 # HTX bootme_period:
67 # 1 - every 20 minutes
68 # 2 - every 30 minutes
69 # 3 - every hour
70 # 4 - every midnight
71 # **********************************
Peter D Phan028b8fd2022-04-19 11:20:28 -050072 Run Soft Bootme ${BOOTME_PERIOD}
73
74 FOR ${index} IN RANGE 999999
75 ${l_ping}=
76 ... Run Keyword And Return Status Ping Host ${OS_HOST}
77
78 IF '${l_ping}' == '${False}'
79 Log to console ("OS Host is rebooting")
sarandev38c984ff2023-07-12 05:10:58 -050080 # Wait for OS (re) Boot - Max 20 minutes
81 FOR ${waitindex} IN RANGE 40
Peter D Phan028b8fd2022-04-19 11:20:28 -050082 Run Key U Sleep \ 30s
83 ${l_ping}=
84 ... Run Keyword And Return Status Ping Host ${OS_HOST}
85 Exit For Loop If '${l_ping}' == '${True}'
86 END
87
sarandev38c984ff2023-07-12 05:10:58 -050088 Run Keyword If '${l_ping}' == '${False}' Fail msg=OS not pinging in 20 minutes
Peter D Phan028b8fd2022-04-19 11:20:28 -050089
sarandev38c984ff2023-07-12 05:10:58 -050090 Wait Until Keyword Succeeds
91 ... 1 min 30 sec Verify Ping SSH And Redfish Authentication
92
sarandev36216cb02023-08-02 06:04:38 -050093 Wait Until Keyword Succeeds
94 ... 3x 60 sec OS Execute Command uptime
95 Wait Until Keyword Succeeds
96 ... 1 min 30 sec Check HTX Run Status
Peter D Phan028b8fd2022-04-19 11:20:28 -050097
98 Set Suite Variable ${iteration} ${iteration + 1}
99 ${loop_count}= Catenate Completed reboot number: ${iteration}
100
101 Printn
102 Rprint Vars loop_count
103 END
104
105 ${currentTime} = Get Current Date
106 ${elapsedTimeSec} =
107 ... Subtract Date From Date
108 ... ${currentTime} ${startTime} result_format=number exclude_millis=True
109 Exit For Loop If ${runtime} < ${elapsedTimeSec}
110 END
111
112 Wait Until Keyword Succeeds
sarandev36216cb02023-08-02 06:04:38 -0500113 ... 15 min 30 sec Verify Ping SSH And Redfish Authentication
George Keishing343c95f2022-08-22 23:12:05 -0500114
sarandev3772e7b22023-08-07 02:40:35 -0500115 Wait Until Keyword Succeeds
116 ... 2 min 60 sec Shutdown Bootme
George Keishing343c95f2022-08-22 23:12:05 -0500117
118 # If user needs to keep the HTX running to debug on failure or post processing.
sarandev3772e7b22023-08-07 02:40:35 -0500119 Run Keyword If ${HTX_KEEP_RUNNING} == ${0}
120 ... Wait Until Keyword Succeeds
121 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500122
123
124Test Setup Execution
125 [Documentation] Do the initial test setup.
126
127 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
128 ... cat /etc/os-release
129 Printn
130 Rprint Vars bmc_versionhtxcmdline -bootme
131
132 ${fw_version}= Get BMC Version
133 Rprint Vars fw_version
134
135 ${is_redfish}= Run Keyword And Return Status Redfish.Login
136 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
137 Rprint Vars rest_keyword
138 Set Suite Variable ${rest_keyword} children=true
139
140 Run Keyword ${rest_keyword} Power On stack_mode=skip
141
142 Run Key U Sleep \ 15s
143 Run Keyword And Ignore Error Delete All Error Logs
144 Run Keyword And Ignore Error Redfish Purge Event Log
145 Tool Exist htxcmdline
146
147 ${os_release_info}= utils_os.Get OS Release Info uname
148 Rprint Vars os_release_info fmt=1
149
150 # Shutdown if HTX is running.
151 ${status}= Is HTX Running
152 Run Keyword If '${status}' == 'True'
153 ... Shutdown HTX Exerciser
154
155
156Test Teardown Execution
157 [Documentation] Do the post-test teardown.
158
159 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
160 Run Keyword If
161 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
162 ... Shutdown HTX Exerciser
163
164 ${keyword_buf}= Catenate Stop SOL Console Logging
165 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
166 Run Key ${keyword_buf}
167
168 Close All Connections