blob: 7a54465950de32e5c14a56ee0e8b7f8908fc91c1 [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
sarandev3c6f50062023-08-10 06:07:22 -050036 Rprint Vars BOOTME_PERIOD HTX_LOOP
Peter D Phan028b8fd2022-04-19 11:20:28 -050037
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
George Keishing343c95f2022-08-22 23:12:05 -050057 # **********************************
58 # HTX bootme_period:
59 # 1 - every 20 minutes
60 # 2 - every 30 minutes
61 # 3 - every hour
62 # 4 - every midnight
63 # **********************************
sarandev3c6f50062023-08-10 06:07:22 -050064
65 # Set a boot interval based on the given boot me period.
66
67 ${boot_interval}= Set Variable If
68 ... ${BOOTME_PERIOD} == 1 20m
69 ... ${BOOTME_PERIOD} == 2 30m
70 ... ${BOOTME_PERIOD} == 3 1h
71
72 ${runtime}= Convert Time ${boot_interval}
73
74 ${startTime} = Get Current Date
75 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
76 ... Create Default MDT Profile
77
78 Run MDT Profile
79
Peter D Phan028b8fd2022-04-19 11:20:28 -050080 Run Soft Bootme ${BOOTME_PERIOD}
81
82 FOR ${index} IN RANGE 999999
83 ${l_ping}=
84 ... Run Keyword And Return Status Ping Host ${OS_HOST}
85
86 IF '${l_ping}' == '${False}'
87 Log to console ("OS Host is rebooting")
sarandev38c984ff2023-07-12 05:10:58 -050088 # Wait for OS (re) Boot - Max 20 minutes
89 FOR ${waitindex} IN RANGE 40
Peter D Phan028b8fd2022-04-19 11:20:28 -050090 Run Key U Sleep \ 30s
91 ${l_ping}=
92 ... Run Keyword And Return Status Ping Host ${OS_HOST}
93 Exit For Loop If '${l_ping}' == '${True}'
94 END
95
sarandev38c984ff2023-07-12 05:10:58 -050096 Run Keyword If '${l_ping}' == '${False}' Fail msg=OS not pinging in 20 minutes
Peter D Phan028b8fd2022-04-19 11:20:28 -050097
sarandev38c984ff2023-07-12 05:10:58 -050098 Wait Until Keyword Succeeds
99 ... 1 min 30 sec Verify Ping SSH And Redfish Authentication
100
sarandev36216cb02023-08-02 06:04:38 -0500101 Wait Until Keyword Succeeds
102 ... 3x 60 sec OS Execute Command uptime
103 Wait Until Keyword Succeeds
104 ... 1 min 30 sec Check HTX Run Status
Peter D Phan028b8fd2022-04-19 11:20:28 -0500105
106 Set Suite Variable ${iteration} ${iteration + 1}
107 ${loop_count}= Catenate Completed reboot number: ${iteration}
108
109 Printn
110 Rprint Vars loop_count
111 END
112
113 ${currentTime} = Get Current Date
114 ${elapsedTimeSec} =
115 ... Subtract Date From Date
116 ... ${currentTime} ${startTime} result_format=number exclude_millis=True
117 Exit For Loop If ${runtime} < ${elapsedTimeSec}
118 END
119
120 Wait Until Keyword Succeeds
sarandev36216cb02023-08-02 06:04:38 -0500121 ... 15 min 30 sec Verify Ping SSH And Redfish Authentication
George Keishing343c95f2022-08-22 23:12:05 -0500122
sarandev3772e7b22023-08-07 02:40:35 -0500123 Wait Until Keyword Succeeds
124 ... 2 min 60 sec Shutdown Bootme
George Keishing343c95f2022-08-22 23:12:05 -0500125
126 # If user needs to keep the HTX running to debug on failure or post processing.
sarandev3772e7b22023-08-07 02:40:35 -0500127 Run Keyword If ${HTX_KEEP_RUNNING} == ${0}
128 ... Wait Until Keyword Succeeds
129 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500130
131
132Test Setup Execution
133 [Documentation] Do the initial test setup.
134
135 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
136 ... cat /etc/os-release
137 Printn
138 Rprint Vars bmc_versionhtxcmdline -bootme
139
140 ${fw_version}= Get BMC Version
141 Rprint Vars fw_version
142
143 ${is_redfish}= Run Keyword And Return Status Redfish.Login
144 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
145 Rprint Vars rest_keyword
146 Set Suite Variable ${rest_keyword} children=true
147
148 Run Keyword ${rest_keyword} Power On stack_mode=skip
149
150 Run Key U Sleep \ 15s
151 Run Keyword And Ignore Error Delete All Error Logs
152 Run Keyword And Ignore Error Redfish Purge Event Log
153 Tool Exist htxcmdline
154
155 ${os_release_info}= utils_os.Get OS Release Info uname
156 Rprint Vars os_release_info fmt=1
157
158 # Shutdown if HTX is running.
159 ${status}= Is HTX Running
160 Run Keyword If '${status}' == 'True'
sarandev332199df2023-08-07 04:31:04 -0500161 ... Wait Until Keyword Succeeds
162 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500163
164Test Teardown Execution
165 [Documentation] Do the post-test teardown.
166
167 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
168 Run Keyword If
169 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
sarandev332199df2023-08-07 04:31:04 -0500170 ... Wait Until Keyword Succeeds
171 ... 2 min 60 sec Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500172
173 ${keyword_buf}= Catenate Stop SOL Console Logging
174 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
175 Run Key ${keyword_buf}
176
177 Close All Connections