blob: 42153b2fb27546e28cb730642c11dfa71036b47f [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
George Keishing87dc4422023-10-20 12:56:30 +053025Force Tags HTX_Softbootme
26
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
77 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
78 ... Create Default MDT Profile
79
80 Run MDT Profile
81
Peter D Phan028b8fd2022-04-19 11:20:28 -050082 Run Soft Bootme ${BOOTME_PERIOD}
83
84 FOR ${index} IN RANGE 999999
85 ${l_ping}=
86 ... Run Keyword And Return Status Ping Host ${OS_HOST}
87
88 IF '${l_ping}' == '${False}'
89 Log to console ("OS Host is rebooting")
sarandev38c984ff2023-07-12 05:10:58 -050090 # Wait for OS (re) Boot - Max 20 minutes
91 FOR ${waitindex} IN RANGE 40
Peter D Phan028b8fd2022-04-19 11:20:28 -050092 Run Key U Sleep \ 30s
93 ${l_ping}=
94 ... Run Keyword And Return Status Ping Host ${OS_HOST}
95 Exit For Loop If '${l_ping}' == '${True}'
96 END
97
sarandev38c984ff2023-07-12 05:10:58 -050098 Run Keyword If '${l_ping}' == '${False}' Fail msg=OS not pinging in 20 minutes
Peter D Phan028b8fd2022-04-19 11:20:28 -050099
sarandev38c984ff2023-07-12 05:10:58 -0500100 Wait Until Keyword Succeeds
101 ... 1 min 30 sec Verify Ping SSH And Redfish Authentication
102
sarandev36216cb02023-08-02 06:04:38 -0500103 Wait Until Keyword Succeeds
104 ... 3x 60 sec OS Execute Command uptime
105 Wait Until Keyword Succeeds
106 ... 1 min 30 sec Check HTX Run Status
Peter D Phan028b8fd2022-04-19 11:20:28 -0500107
108 Set Suite Variable ${iteration} ${iteration + 1}
109 ${loop_count}= Catenate Completed reboot number: ${iteration}
110
111 Printn
112 Rprint Vars loop_count
113 END
114
115 ${currentTime} = Get Current Date
116 ${elapsedTimeSec} =
117 ... Subtract Date From Date
118 ... ${currentTime} ${startTime} result_format=number exclude_millis=True
119 Exit For Loop If ${runtime} < ${elapsedTimeSec}
120 END
121
122 Wait Until Keyword Succeeds
sarandev36216cb02023-08-02 06:04:38 -0500123 ... 15 min 30 sec Verify Ping SSH And Redfish Authentication
George Keishing343c95f2022-08-22 23:12:05 -0500124
sarandev3772e7b22023-08-07 02:40:35 -0500125 Wait Until Keyword Succeeds
126 ... 2 min 60 sec Shutdown Bootme
George Keishing343c95f2022-08-22 23:12:05 -0500127
128 # If user needs to keep the HTX running to debug on failure or post processing.
sarandev3772e7b22023-08-07 02:40:35 -0500129 Run Keyword If ${HTX_KEEP_RUNNING} == ${0}
130 ... Wait Until Keyword Succeeds
131 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500132
133
134Test Setup Execution
135 [Documentation] Do the initial test setup.
136
137 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
138 ... cat /etc/os-release
139 Printn
140 Rprint Vars bmc_versionhtxcmdline -bootme
141
142 ${fw_version}= Get BMC Version
143 Rprint Vars fw_version
144
145 ${is_redfish}= Run Keyword And Return Status Redfish.Login
146 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
147 Rprint Vars rest_keyword
148 Set Suite Variable ${rest_keyword} children=true
149
150 Run Keyword ${rest_keyword} Power On stack_mode=skip
151
152 Run Key U Sleep \ 15s
153 Run Keyword And Ignore Error Delete All Error Logs
154 Run Keyword And Ignore Error Redfish Purge Event Log
155 Tool Exist htxcmdline
156
157 ${os_release_info}= utils_os.Get OS Release Info uname
158 Rprint Vars os_release_info fmt=1
159
160 # Shutdown if HTX is running.
161 ${status}= Is HTX Running
162 Run Keyword If '${status}' == 'True'
sarandev332199df2023-08-07 04:31:04 -0500163 ... Wait Until Keyword Succeeds
164 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500165
166Test Teardown Execution
167 [Documentation] Do the post-test teardown.
168
169 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
170 Run Keyword If
171 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
sarandev332199df2023-08-07 04:31:04 -0500172 ... Wait Until Keyword Succeeds
173 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500174
175 ${keyword_buf}= Catenate Stop SOL Console Logging
176 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
177 Run Key ${keyword_buf}
178
179 Close All Connections