blob: 6a15248b72058357ea96e8458f854e3298cd5a1a [file] [log] [blame]
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -06001*** Settings ***
Sridevi Ramesh1d85af02019-02-22 04:08:15 -06002Documentation Utility for error injection scenarios through HOST & BMC.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -06003Resource ../../lib/rest_client.robot
4Resource ../../lib/utils.robot
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -05005Resource ../../lib/common_utils.robot
George Keishing87567432017-10-24 03:48:13 -05006Variables ../../lib/ras/variables.py
7Library ../../lib/bmc_ssh_utils.py
Sridevi Ramesh70978ed2017-11-22 23:56:50 -06008Library ../../lib/gen_print.py
9Library ../../lib/gen_robot_print.py
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060010
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -050011Library OperatingSystem
12
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060013*** Keywords ***
14
15Getscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060016 [Documentation] Executes getscom command on OS with the given
17 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060018 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060019 # Description of arguments:
20 # input_cmd -l|--list-chips
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060021 # -c|--chip <chip-id> <addr>
22
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050023 ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060024 [Return] ${output}
25
26Gard Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060027 [Documentation] Executes opal-gard command on OS with the given
28 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060029 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060030 # Description of arguments:
31 # input_cmd list/clear all/show <gard_record_id>
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060032
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050033 ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060034 [Return] ${output}
35
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050036Putscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060037 [Documentation] Executes putscom command on OS with the given
38 ... input arguments.
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060039 [Arguments] ${proc_chip_id} ${fir_address} ${value}
Sridevi Rameshea36b412017-03-09 04:08:02 -060040 # Description of arguments:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050041 # proc_chip_id Processor ID (e.g '0', '8').
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060042 # fir_address FIR (Fault isolation register) value (e.g. 2011400).
43 # value (e.g 4000000000000000).
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060044
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060045 ${cmd}= Catenate putscom -c 0x${proc_chip_id} 0x${fir_address} 0x${value}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060046 Start Command ${cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060047
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050048Get ProcChipId From OS
49 [Documentation] Get processor chip ID values based on the input.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050050 [Arguments] ${chip_type} ${master_proc_chip}
Sridevi Rameshea36b412017-03-09 04:08:02 -060051 # Description of arguments:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050052 # chip_type The chip type (Processor/Centaur).
53 # master_proc_chip Processor chip type ('True' or 'False').
Sridevi Rameshea36b412017-03-09 04:08:02 -060054
55 ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050056 ${proc_chip_id}= Getscom Operations On OS ${cmd}
57 # Example output:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050058 # getscom -l | grep processor | cut -c1-8
59 # 00000008 - False
60 # 00000000 - True
61
62 ${proc_ids}= Split String ${proc_chip_id}
63 ${proc_id}= Run Keyword If '${master_proc_chip}' == 'True'
George Keishing579542e2020-02-05 10:07:26 -060064 ... Get From List ${proc_ids} 1
65 ... ELSE Get From List ${proc_ids} 0
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050066
67 # Example output:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050068 # 00000008
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050069 [Return] ${proc_id}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050070
71Get Core IDs From OS
72 [Documentation] Get Core IDs corresponding to the input processor chip ID.
73 [Arguments] ${proc_chip_id}
74 # Description of argument(s):
75 # proc_chip_id Processor ID (e.g '0', '8').
76
77 ${cmd}= Catenate set -o pipefail ; ${probe_cpu_file_path}
78 ... | grep -i 'CHIP ID: ${proc_chip_id}' | cut -c21-22
79 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050080 ${core_ids}= Split String ${output}
81 # Example output:
82 # ['2', '3', '4', '5', '6']
83 [Return] ${core_ids}
84
85FIR Address Translation Through HOST
86 [Documentation] Do FIR address translation through host for given FIR,
87 ... core value & target type.
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060088 [Arguments] ${fir_address} ${core_id} ${target_type}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050089 # Description of argument(s):
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060090 # fir_address FIR (Fault isolation register) value (e.g. 2011400).
91 # core_id Core ID (e.g. 9).
92 # target_type Target type (e.g. 'EQ', 'EX', 'C').
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050093
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -060094 ${cmd}= Catenate set -o pipefail ; ${addr_translation_file_path} ${fir_address}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050095 ... ${core_id} | grep -i ${target_type}
96 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050097 ${translated_addr}= Split String ${output} :${SPACE}0x
98 # Example output:
99 # 0x10010c00
100 [Return] ${translated_addr[1]}
George Keishinge7dc4472017-10-30 08:58:37 -0500101
George Keishinge7dc4472017-10-30 08:58:37 -0500102Inject Error Through HOST
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600103 [Documentation] Inject checkstop on multiple targets like
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500104 ... CPU/CME/OCC/NPU/CAPP/MCA etc. through HOST.
George Keishinge7dc4472017-10-30 08:58:37 -0500105 ... Test sequence:
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500106 ... 1. Boot To HOST.
107 ... 2. Clear any existing gard records.
108 ... 3. Inject Error on processor.
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600109 [Arguments] ${fir_address} ${value} ${threshold_limit}
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500110 ... ${master_proc_chip}=True
George Keishinge7dc4472017-10-30 08:58:37 -0500111 # Description of argument(s):
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600112 # fir_address FIR (Fault isolation register) value (e.g. 2011400).
113 # value (e.g 2000000000000000).
George Keishinge7dc4472017-10-30 08:58:37 -0500114 # threshold_limit Threshold limit (e.g 1, 5, 32).
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500115 # master_proc_chip Processor chip type (True' or 'False').
George Keishinge7dc4472017-10-30 08:58:37 -0500116
117 Delete Error Logs
118 Login To OS Host
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -0500119 Set Auto Reboot 1
George Keishinge7dc4472017-10-30 08:58:37 -0500120 Gard Operations On OS clear all
121
122 # Fetch processor chip IDs.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500123 ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip}
George Keishinge7dc4472017-10-30 08:58:37 -0500124
125 ${threshold_limit}= Convert To Integer ${threshold_limit}
George Keishing579542e2020-02-05 10:07:26 -0600126 FOR ${count} IN RANGE ${threshold_limit}
127 Run Keyword Putscom Operations On OS ${proc_chip_id} ${fir_address}
128 ... ${value}
129 # Adding delay after each error injection.
130 Sleep 10s
131 END
132
George Keishinge7dc4472017-10-30 08:58:37 -0500133 # Adding delay to get error log after error injection.
134 Sleep 120s
135
George Keishinge7dc4472017-10-30 08:58:37 -0500136Code Update Unrecoverable Error Inject
137 [Documentation] Inject UE MCACALFIR checkstop on processor through
138 ... host during PNOR code update.
139
140 Inject Error Through HOST 05010800 4000000000000000 1
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600141
142Disable CPU States Through HOST
143 [Documentation] Disable CPU states through host.
144
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500145 # Fetch number of states present for cpu0.
146 ${cmd}= Catenate ls /sys/devices/system/cpu/cpu0/cpuidle|grep state|wc -l
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600147 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500148 ${no_of_states}= Convert To Integer ${output}
149
150 # Disable state for all cpus.
Sridevi Ramesh76bc9ab2019-11-07 09:32:16 -0600151 FOR ${count} IN RANGE ${no_of_states}
152 ${cmd}= Catenate SEPARATOR= for file_path in /sys/devices/system/cpu/
153 ... cpu*/cpuidle/state${count}/disable; do echo 1 > $file_path; done
154 ${output} ${stderr} ${rc}= Run Keyword OS Execute Command ${cmd}
155 END
Sridevi Rameshd079e9d2018-02-13 01:14:58 -0600156
157Is Opal-PRD Service Enabled
158 [Documentation] Check if Opal-PRD service is running & return either
159 ... 'enabled' or 'disabled'.
160
161 ${cmd}= Catenate systemctl list-unit-files | grep opal-prd
162 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
163 ${opal_prd_state}= Split String ${output}
164
165 # Example output from prior command:
166 # opal-prd.service enabled
167 [Return] ${opal_prd_state[1]}
168
169Enable Opal-PRD Service On HOST
170 [Documentation] Enable Opal-PRD service on host.
171
172 OS Execute Command service opal-prd start
173 ${opal_prd_state}= Is Opal-PRD Service Enabled
174 Should Contain ${opal_prd_state} enabled
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -0600175
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600176
177Inject Error Through BMC
178 [Documentation] Inject checkstop on multiple targets like
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500179 ... CPU/CME/OCC/NPU/CAPP/MCA etc. through BMC.
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600180 ... Test sequence:
181 ... 1. Boot To HOST.
182 ... 2. Clear any existing gard records.
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500183 ... 3. Inject Error on processor.
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600184 [Arguments] ${fir_address} ${value} ${threshold_limit}
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600185 ... ${master_proc_chip}=True
186 # Description of argument(s):
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600187 # fir_address FIR (Fault isolation register) value (e.g. '2011400').
188 # value (e.g. '2000000000000000').
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600189 # threshold_limit Recoverable error threshold limit (e.g. '1', '5', '32').
190
191 Delete Error Logs
192 Login To OS Host
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -0500193 Set Auto Reboot 1
194
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600195 Gard Operations On OS clear all
196
197 ${threshold_limit}= Convert To Integer ${threshold_limit}
George Keishing579542e2020-02-05 10:07:26 -0600198 FOR ${count} IN RANGE ${threshold_limit}
199 Pdbg -p0 putscom 0x${fir_address} 0x${value}
200 # Adding delay after each error injection.
201 Sleep 10s
202 END
203
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600204 # Adding delay to get error log after error injection.
205 Sleep 120s
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500206
207
208Inject Error Through BMC At HOST Boot
209 [Documentation] Inject error on multiple targets like
210 ... CPU/CME/OCC/NPU/CAPP/MCA etc. through BMC at HOST Boot.
211 ... Test sequence:
212 ... 1. Boot To HOST.
213 ... 2. Clear any existing gard records.
214 ... 3. Power off HOST and Boot.
215 ... 4. Inject Error on processor through BMC.
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600216 [Arguments] ${fir_address} ${value}
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500217 # Description of argument(s):
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600218 # fir_address FIR (Fault isolation register) value (e.g. '2011400').
219 # value (e.g. '2000000000000000').
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500220
221 Delete Error Logs
222
223 REST Power On stack_mode=skip
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500224
225 Gard Operations On OS clear all
226
227 REST Power Off
Sridevi Rameshb42a06e2019-07-23 06:39:23 -0500228 Set Auto Reboot 1
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500229 Initiate Host Boot wait=${0}
230
231 Start SOL Console Logging ${EXECDIR}/esol.log
232
233 Wait Until Keyword Succeeds 5 min 5 sec
234 ... Shell Cmd grep 'ISTEP *14' ${EXECDIR}/esol.log quiet=1
235 ... print_output=0 show_err=0 ignore_err=0
236
Sridevi Ramesh9617ebd2019-11-25 10:57:21 -0600237 Pdbg -p0 putscom 0x${fir_address} 0x${value}
Sridevi Ramesh3e2a3bd2019-05-09 05:30:53 -0500238 # Adding delay to get error log after error injection.
239 Sleep 10s
240
241 Stop SOL Console Logging