blob: 19996b83be71bed96c9baffadd612a0ab7548560 [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
Peter D Phan028b8fd2022-04-19 11:20:28 -050093 OS Execute Command uptime
94 Check HTX Run Status
95
96 Set Suite Variable ${iteration} ${iteration + 1}
97 ${loop_count}= Catenate Completed reboot number: ${iteration}
98
99 Printn
100 Rprint Vars loop_count
101 END
102
103 ${currentTime} = Get Current Date
104 ${elapsedTimeSec} =
105 ... Subtract Date From Date
106 ... ${currentTime} ${startTime} result_format=number exclude_millis=True
107 Exit For Loop If ${runtime} < ${elapsedTimeSec}
108 END
109
110 Wait Until Keyword Succeeds
111 ... 15 min 30 sec Verify Ping and REST Authentication
George Keishing343c95f2022-08-22 23:12:05 -0500112
Peter D Phan028b8fd2022-04-19 11:20:28 -0500113 Shutdown Bootme
George Keishing343c95f2022-08-22 23:12:05 -0500114
115 # If user needs to keep the HTX running to debug on failure or post processing.
116 Run Keyword If ${HTX_KEEP_RUNNING} == ${0} Shutdown HTX Exerciser
Peter D Phan028b8fd2022-04-19 11:20:28 -0500117
118
119Test Setup Execution
120 [Documentation] Do the initial test setup.
121
122 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
123 ... cat /etc/os-release
124 Printn
125 Rprint Vars bmc_versionhtxcmdline -bootme
126
127 ${fw_version}= Get BMC Version
128 Rprint Vars fw_version
129
130 ${is_redfish}= Run Keyword And Return Status Redfish.Login
131 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
132 Rprint Vars rest_keyword
133 Set Suite Variable ${rest_keyword} children=true
134
135 Run Keyword ${rest_keyword} Power On stack_mode=skip
136
137 Run Key U Sleep \ 15s
138 Run Keyword And Ignore Error Delete All Error Logs
139 Run Keyword And Ignore Error Redfish Purge Event Log
140 Tool Exist htxcmdline
141
142 ${os_release_info}= utils_os.Get OS Release Info uname
143 Rprint Vars os_release_info fmt=1
144
145 # Shutdown if HTX is running.
146 ${status}= Is HTX Running
147 Run Keyword If '${status}' == 'True'
148 ... Shutdown HTX Exerciser
149
150
151Test Teardown Execution
152 [Documentation] Do the post-test teardown.
153
154 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
155 Run Keyword If
156 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
157 ... Shutdown HTX Exerciser
158
159 ${keyword_buf}= Catenate Stop SOL Console Logging
160 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
161 Run Key ${keyword_buf}
162
163 Close All Connections