blob: bf989ddaa9f64850de7ab445d6235080a379ef93 [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
George Keishing87567432017-10-24 03:48:13 -05005Variables ../../lib/ras/variables.py
6Library ../../lib/bmc_ssh_utils.py
Sridevi Ramesh70978ed2017-11-22 23:56:50 -06007Library ../../lib/gen_print.py
8Library ../../lib/gen_robot_print.py
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -06009
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -050010Library OperatingSystem
11
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060012*** Keywords ***
13
14Getscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060015 [Documentation] Executes getscom command on OS with the given
16 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060017 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060018 # Description of arguments:
19 # input_cmd -l|--list-chips
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060020 # -c|--chip <chip-id> <addr>
21
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050022 ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060023 [Return] ${output}
24
25Gard Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060026 [Documentation] Executes opal-gard command on OS with the given
27 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060028 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060029 # Description of arguments:
30 # input_cmd list/clear all/show <gard_record_id>
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060031
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050032 ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060033 [Return] ${output}
34
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050035Putscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060036 [Documentation] Executes putscom command on OS with the given
37 ... input arguments.
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050038 [Arguments] ${proc_chip_id} ${fru} ${address}
Sridevi Rameshea36b412017-03-09 04:08:02 -060039 # Description of arguments:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050040 # proc_chip_id Processor ID (e.g '0', '8').
Sridevi Rameshea36b412017-03-09 04:08:02 -060041 # fru FRU value (e.g. 2011400).
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050042 # address Chip address (e.g 4000000000000000).
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060043
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050044 ${cmd}= Catenate putscom -c 0x${proc_chip_id} 0x${fru} 0x${address}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060045 Start Command ${cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060046
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050047Get ProcChipId From OS
48 [Documentation] Get processor chip ID values based on the input.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050049 [Arguments] ${chip_type} ${master_proc_chip}
Sridevi Rameshea36b412017-03-09 04:08:02 -060050 # Description of arguments:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050051 # chip_type The chip type (Processor/Centaur).
52 # master_proc_chip Processor chip type ('True' or 'False').
Sridevi Rameshea36b412017-03-09 04:08:02 -060053
54 ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050055 ${proc_chip_id}= Getscom Operations On OS ${cmd}
56 # Example output:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050057 # getscom -l | grep processor | cut -c1-8
58 # 00000008 - False
59 # 00000000 - True
60
61 ${proc_ids}= Split String ${proc_chip_id}
62 ${proc_id}= Run Keyword If '${master_proc_chip}' == 'True'
63 \ ... Get From List ${proc_ids} 1
64 \ ... ELSE Get From List ${proc_ids} 0
65
66 # Example output:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050067 # 00000008
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050068 [Return] ${proc_id}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050069
70Get Core IDs From OS
71 [Documentation] Get Core IDs corresponding to the input processor chip ID.
72 [Arguments] ${proc_chip_id}
73 # Description of argument(s):
74 # proc_chip_id Processor ID (e.g '0', '8').
75
76 ${cmd}= Catenate set -o pipefail ; ${probe_cpu_file_path}
77 ... | grep -i 'CHIP ID: ${proc_chip_id}' | cut -c21-22
78 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050079 ${core_ids}= Split String ${output}
80 # Example output:
81 # ['2', '3', '4', '5', '6']
82 [Return] ${core_ids}
83
84FIR Address Translation Through HOST
85 [Documentation] Do FIR address translation through host for given FIR,
86 ... core value & target type.
87 [Arguments] ${fir} ${core_id} ${target_type}
88 # Description of argument(s):
89 # fir FIR (Fault isolation register) value (e.g. 2011400).
90 # core_id Core ID (e.g. 9).
91 # target_type Target type (e.g. 'EQ', 'EX', 'C').
92
93 ${cmd}= Catenate set -o pipefail ; ${addr_translation_file_path} ${fir}
94 ... ${core_id} | grep -i ${target_type}
95 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050096 ${translated_addr}= Split String ${output} :${SPACE}0x
97 # Example output:
98 # 0x10010c00
99 [Return] ${translated_addr[1]}
George Keishinge7dc4472017-10-30 08:58:37 -0500100
George Keishinge7dc4472017-10-30 08:58:37 -0500101Inject Error Through HOST
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600102 [Documentation] Inject checkstop on multiple targets like
103 ... CPU/CME/OCC/NPU/CAPP/MCA etc through HOST.
George Keishinge7dc4472017-10-30 08:58:37 -0500104 ... Test sequence:
105 ... 1. Boot To HOST
106 ... 2. Clear any existing gard records
107 ... 3. Inject Error on processor/centaur
108 [Arguments] ${fir} ${chip_address} ${threshold_limit}
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500109 ... ${master_proc_chip}=True
George Keishinge7dc4472017-10-30 08:58:37 -0500110 # Description of argument(s):
111 # fir FIR (Fault isolation register) value (e.g. 2011400).
112 # chip_address chip address (e.g 2000000000000000).
113 # threshold_limit Threshold limit (e.g 1, 5, 32).
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500114 # master_proc_chip Processor chip type (True' or 'False').
George Keishinge7dc4472017-10-30 08:58:37 -0500115
116 Delete Error Logs
117 Login To OS Host
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -0500118 Set Auto Reboot 1
George Keishinge7dc4472017-10-30 08:58:37 -0500119 Gard Operations On OS clear all
120
121 # Fetch processor chip IDs.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500122 ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip}
George Keishinge7dc4472017-10-30 08:58:37 -0500123
124 ${threshold_limit}= Convert To Integer ${threshold_limit}
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600125 :FOR ${count} IN RANGE ${threshold_limit}
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500126 \ Run Keyword Putscom Operations On OS ${proc_chip_id} ${fir}
127 ... ${chip_address}
George Keishinge7dc4472017-10-30 08:58:37 -0500128 # Adding delay after each error injection.
129 \ Sleep 10s
130 # Adding delay to get error log after error injection.
131 Sleep 120s
132
George Keishinge7dc4472017-10-30 08:58:37 -0500133Code Update Unrecoverable Error Inject
134 [Documentation] Inject UE MCACALFIR checkstop on processor through
135 ... host during PNOR code update.
136
137 Inject Error Through HOST 05010800 4000000000000000 1
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600138
139Disable CPU States Through HOST
140 [Documentation] Disable CPU states through host.
141
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500142 # Fetch number of states present for cpu0.
143 ${cmd}= Catenate ls /sys/devices/system/cpu/cpu0/cpuidle|grep state|wc -l
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600144 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500145 ${no_of_states}= Convert To Integer ${output}
146
147 # Disable state for all cpus.
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600148 :FOR ${count} IN RANGE ${no_of_states}
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500149 \ ${cmd}= Catenate SEPARATOR= for file_path in /sys/devices/system/cpu/
150 ... cpu*/cpuidle/state${i}/disable; do echo 1 > $file_path; done
151 \ ${output} ${stderr} ${rc}= Run Keyword OS Execute Command ${cmd}
Sridevi Rameshd079e9d2018-02-13 01:14:58 -0600152
153Is Opal-PRD Service Enabled
154 [Documentation] Check if Opal-PRD service is running & return either
155 ... 'enabled' or 'disabled'.
156
157 ${cmd}= Catenate systemctl list-unit-files | grep opal-prd
158 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
159 ${opal_prd_state}= Split String ${output}
160
161 # Example output from prior command:
162 # opal-prd.service enabled
163 [Return] ${opal_prd_state[1]}
164
165Enable Opal-PRD Service On HOST
166 [Documentation] Enable Opal-PRD service on host.
167
168 OS Execute Command service opal-prd start
169 ${opal_prd_state}= Is Opal-PRD Service Enabled
170 Should Contain ${opal_prd_state} enabled
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -0600171
172BMC Putscom
173 [Documentation] Executes putscom command through BMC.
174
175 [Arguments] ${proc_chip_id} ${fru} ${chip_address}
176
177 # Description of argument(s):
178 # proc_chip_id Processor ID (e.g '0', '8').
179 # fru FRU (field replaceable unit) (e.g. '2011400').
180 # chip_address Chip address (e.g. '4000000000000000').
181
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600182 ${cmd}= Catenate pdbg -d p9w -p${proc_chip_id} putscom 0x${fru} 0x${chip_address}
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -0600183
184 BMC Execute Command ${cmd}
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600185
186Inject Error Through BMC
187 [Documentation] Inject checkstop on multiple targets like
188 ... CPU/CME/OCC/NPU/CAPP/MCA etc through BMC.
189 ... Test sequence:
190 ... 1. Boot To HOST.
191 ... 2. Clear any existing gard records.
192 ... 3. Inject Error on processor/centaur.
193 [Arguments] ${fir} ${chip_address} ${threshold_limit}
194 ... ${master_proc_chip}=True
195 # Description of argument(s):
196 # fir FIR (Fault isolation register) value (e.g. '2011400').
197 # chip_address Chip address (e.g. '2000000000000000').
198 # threshold_limit Recoverable error threshold limit (e.g. '1', '5', '32').
199
200 Delete Error Logs
201 Login To OS Host
Sridevi Ramesh9c6ec282019-03-25 03:35:46 -0500202 Set Auto Reboot 1
203
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600204 Gard Operations On OS clear all
205
206 ${threshold_limit}= Convert To Integer ${threshold_limit}
207 :FOR ${count} IN RANGE ${threshold_limit}
208 \ BMC Putscom 0 ${fir}
209 ... ${chip_address}
210 # Adding delay after each error injection.
211 \ Sleep 10s
212 # Adding delay to get error log after error injection.
213 Sleep 120s