blob: 974c6df2609478e4039f37407352d98af7034a36 [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
George Keishing3fc63132023-12-14 16:19:07 +053014Resource ../lib/htx_resource.robot
George Keishinga28061a2023-12-15 14:46:54 +053015Resource ../lib/os_utilities.robot
George Keishing91e13742023-12-15 12:07:28 +053016Library ../lib/os_utils_keywords.py
George Keishing343c95f2022-08-22 23:12:05 -050017Resource ../lib/openbmc_ffdc_utils.robot
George Keishing579c72e2023-12-15 18:37:53 +053018Library ../lib/os_utilities.py
Peter D Phan028b8fd2022-04-19 11:20:28 -050019Library DateTime
20
sarandev37459c422023-11-09 01:17:42 -060021Suite Setup Run Keyword And Ignore Error Start SOL Console Logging
Peter D Phan028b8fd2022-04-19 11:20:28 -050022Test Setup Test Setup Execution
23Test Teardown Test Teardown Execution
24
Matt Fischer6fb70d92023-10-24 19:06:33 -060025Test Tags HTX_Softbootme
George Keishing87dc4422023-10-20 12:56:30 +053026
Peter D Phan028b8fd2022-04-19 11:20:28 -050027*** Variables ****
28
Peter D Phan028b8fd2022-04-19 11:20:28 -050029${rest_keyword} REST
30
Peter D Phan028b8fd2022-04-19 11:20:28 -050031*** Test Cases ***
32
33Soft Bootme Test
34 [Documentation] Using HTX exerciser soft boot option.
35 [Tags] Soft_Bootme_Test
36
37 Printn
sarandev3c6f50062023-08-10 06:07:22 -050038 Rprint Vars BOOTME_PERIOD HTX_LOOP
Peter D Phan028b8fd2022-04-19 11:20:28 -050039
40 # Set up the (soft) bootme iteration (loop) counter.
41 Set Suite Variable ${iteration} ${0} children=true
42
43 # Run test
44 Repeat Keyword ${HTX_LOOP} times Run HTX Soft Bootme Exerciser
45
46
47*** Keywords ***
48
49
50Run HTX Soft Bootme Exerciser
51 [Documentation] Run HTX Soft Bootme Exerciser.
52 # Test Flow:
53 # - Power on.
54 # - Create HTX mdt profile.
55 # - Run HTX exerciser.
56 # - Soft bootme (OS Reboot).
57 # - Check HTX status for errors.
58
George Keishing343c95f2022-08-22 23:12:05 -050059 # **********************************
60 # HTX bootme_period:
61 # 1 - every 20 minutes
62 # 2 - every 30 minutes
63 # 3 - every hour
64 # 4 - every midnight
65 # **********************************
sarandev3c6f50062023-08-10 06:07:22 -050066
67 # Set a boot interval based on the given boot me period.
68
69 ${boot_interval}= Set Variable If
70 ... ${BOOTME_PERIOD} == 1 20m
71 ... ${BOOTME_PERIOD} == 2 30m
72 ... ${BOOTME_PERIOD} == 3 1h
73
74 ${runtime}= Convert Time ${boot_interval}
75
76 ${startTime} = Get Current Date
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -050077 IF '${HTX_MDT_PROFILE}' == 'mdt.bu'
78 Create Default MDT Profile
79 END
sarandev3c6f50062023-08-10 06:07:22 -050080
81 Run MDT Profile
82
Peter D Phan028b8fd2022-04-19 11:20:28 -050083 Run Soft Bootme ${BOOTME_PERIOD}
84
85 FOR ${index} IN RANGE 999999
86 ${l_ping}=
87 ... Run Keyword And Return Status Ping Host ${OS_HOST}
88
89 IF '${l_ping}' == '${False}'
90 Log to console ("OS Host is rebooting")
sarandev38c984ff2023-07-12 05:10:58 -050091 # Wait for OS (re) Boot - Max 20 minutes
92 FOR ${waitindex} IN RANGE 40
Peter D Phan028b8fd2022-04-19 11:20:28 -050093 Run Key U Sleep \ 30s
94 ${l_ping}=
95 ... Run Keyword And Return Status Ping Host ${OS_HOST}
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -050096 IF '${l_ping}' == '${True}' BREAK
Peter D Phan028b8fd2022-04-19 11:20:28 -050097 END
98
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -050099 IF '${l_ping}' == '${False}' Fail msg=OS not pinging in 20 minutes
Peter D Phan028b8fd2022-04-19 11:20:28 -0500100
sarandev38c984ff2023-07-12 05:10:58 -0500101 Wait Until Keyword Succeeds
George Keishinge699f342025-04-11 16:41:42 +0530102 ... 2 min 30 sec Verify Ping SSH And Redfish Authentication
sarandev38c984ff2023-07-12 05:10:58 -0500103
sarandev36216cb02023-08-02 06:04:38 -0500104 Wait Until Keyword Succeeds
105 ... 3x 60 sec OS Execute Command uptime
106 Wait Until Keyword Succeeds
107 ... 1 min 30 sec Check HTX Run Status
Peter D Phan028b8fd2022-04-19 11:20:28 -0500108
109 Set Suite Variable ${iteration} ${iteration + 1}
110 ${loop_count}= Catenate Completed reboot number: ${iteration}
111
112 Printn
113 Rprint Vars loop_count
114 END
115
116 ${currentTime} = Get Current Date
117 ${elapsedTimeSec} =
118 ... Subtract Date From Date
119 ... ${currentTime} ${startTime} result_format=number exclude_millis=True
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -0500120 IF ${runtime} < ${elapsedTimeSec} BREAK
Peter D Phan028b8fd2022-04-19 11:20:28 -0500121 END
122
123 Wait Until Keyword Succeeds
sarandev36216cb02023-08-02 06:04:38 -0500124 ... 15 min 30 sec Verify Ping SSH And Redfish Authentication
George Keishing343c95f2022-08-22 23:12:05 -0500125
sarandev3772e7b22023-08-07 02:40:35 -0500126 Wait Until Keyword Succeeds
127 ... 2 min 60 sec Shutdown Bootme
George Keishing343c95f2022-08-22 23:12:05 -0500128
129 # If user needs to keep the HTX running to debug on failure or post processing.
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -0500130 IF ${HTX_KEEP_RUNNING} == ${0}
131 Wait Until Keyword Succeeds 2 min 60 sec Shutdown HTX Exerciser
132 END
Peter D Phan028b8fd2022-04-19 11:20:28 -0500133
134
135Test Setup Execution
136 [Documentation] Do the initial test setup.
137
138 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
139 ... cat /etc/os-release
140 Printn
141 Rprint Vars bmc_versionhtxcmdline -bootme
142
143 ${fw_version}= Get BMC Version
144 Rprint Vars fw_version
145
146 ${is_redfish}= Run Keyword And Return Status Redfish.Login
147 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
148 Rprint Vars rest_keyword
149 Set Suite Variable ${rest_keyword} children=true
150
151 Run Keyword ${rest_keyword} Power On stack_mode=skip
152
153 Run Key U Sleep \ 15s
154 Run Keyword And Ignore Error Delete All Error Logs
155 Run Keyword And Ignore Error Redfish Purge Event Log
156 Tool Exist htxcmdline
157
George Keishinga28061a2023-12-15 14:46:54 +0530158 ${os_release_info}= os_utilities.Get OS Release Info uname
Peter D Phan028b8fd2022-04-19 11:20:28 -0500159 Rprint Vars os_release_info fmt=1
160
161 # Shutdown if HTX is running.
162 ${status}= Is HTX Running
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -0500163 IF '${status}' == 'True'
164 Wait Until Keyword Succeeds 2 min 60 sec Shutdown HTX Exerciser
165 END
166
Peter D Phan028b8fd2022-04-19 11:20:28 -0500167
168Test Teardown Execution
169 [Documentation] Do the post-test teardown.
170
171 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Sridevi Ramesh6dcfc392025-05-06 11:09:43 -0500172 IF '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
173 Wait Until Keyword Succeeds 2 min 60 sec Shutdown HTX Exerciser
174 END
Peter D Phan028b8fd2022-04-19 11:20:28 -0500175
176 ${keyword_buf}= Catenate Stop SOL Console Logging
177 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
sarandev37459c422023-11-09 01:17:42 -0600178 Run Keyword And Ignore Error ${keyword_buf}
Peter D Phan028b8fd2022-04-19 11:20:28 -0500179
George Keishinge699f342025-04-11 16:41:42 +0530180 FFDC On Test Case Fail
181
Peter D Phan028b8fd2022-04-19 11:20:28 -0500182 Close All Connections