blob: a9c52f6501b135b62f5633585760e57bf78574fb [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 Ramesh0c8c4ce2017-02-11 01:28:36 -06007Library OperatingSystem
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
11*** Keywords ***
12
13Getscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060014 [Documentation] Executes getscom command on OS with the given
15 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060016 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060017 # Description of arguments:
18 # input_cmd -l|--list-chips
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060019 # -c|--chip <chip-id> <addr>
20
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050021 ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060022 [Return] ${output}
23
24Gard Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060025 [Documentation] Executes opal-gard command on OS with the given
26 ... input command.
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060027 [Arguments] ${input_cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060028 # Description of arguments:
29 # input_cmd list/clear all/show <gard_record_id>
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060030
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050031 ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060032 [Return] ${output}
33
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050034Putscom Operations On OS
Sridevi Rameshea36b412017-03-09 04:08:02 -060035 [Documentation] Executes putscom command on OS with the given
36 ... input arguments.
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050037 [Arguments] ${proc_chip_id} ${fru} ${address}
Sridevi Rameshea36b412017-03-09 04:08:02 -060038 # Description of arguments:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050039 # proc_chip_id Processor ID (e.g '0', '8').
Sridevi Rameshea36b412017-03-09 04:08:02 -060040 # fru FRU value (e.g. 2011400).
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050041 # address Chip address (e.g 4000000000000000).
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060042
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050043 ${cmd}= Catenate putscom -c 0x${proc_chip_id} 0x${fru} 0x${address}
Sridevi Ramesh0c8c4ce2017-02-11 01:28:36 -060044 Start Command ${cmd}
Sridevi Rameshea36b412017-03-09 04:08:02 -060045
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050046Get ProcChipId From OS
47 [Documentation] Get processor chip ID values based on the input.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050048 [Arguments] ${chip_type} ${master_proc_chip}
Sridevi Rameshea36b412017-03-09 04:08:02 -060049 # Description of arguments:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050050 # chip_type The chip type (Processor/Centaur).
51 # master_proc_chip Processor chip type ('True' or 'False').
Sridevi Rameshea36b412017-03-09 04:08:02 -060052
53 ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050054 ${proc_chip_id}= Getscom Operations On OS ${cmd}
55 # Example output:
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050056 # getscom -l | grep processor | cut -c1-8
57 # 00000008 - False
58 # 00000000 - True
59
60 ${proc_ids}= Split String ${proc_chip_id}
61 ${proc_id}= Run Keyword If '${master_proc_chip}' == 'True'
62 \ ... Get From List ${proc_ids} 1
63 \ ... ELSE Get From List ${proc_ids} 0
64
65 # Example output:
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050066 # 00000008
Sridevi Rameshcf4507c2017-10-26 04:13:50 -050067 [Return] ${proc_id}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050068
69Get Core IDs From OS
70 [Documentation] Get Core IDs corresponding to the input processor chip ID.
71 [Arguments] ${proc_chip_id}
72 # Description of argument(s):
73 # proc_chip_id Processor ID (e.g '0', '8').
74
75 ${cmd}= Catenate set -o pipefail ; ${probe_cpu_file_path}
76 ... | grep -i 'CHIP ID: ${proc_chip_id}' | cut -c21-22
77 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050078 ${core_ids}= Split String ${output}
79 # Example output:
80 # ['2', '3', '4', '5', '6']
81 [Return] ${core_ids}
82
83FIR Address Translation Through HOST
84 [Documentation] Do FIR address translation through host for given FIR,
85 ... core value & target type.
86 [Arguments] ${fir} ${core_id} ${target_type}
87 # Description of argument(s):
88 # fir FIR (Fault isolation register) value (e.g. 2011400).
89 # core_id Core ID (e.g. 9).
90 # target_type Target type (e.g. 'EQ', 'EX', 'C').
91
92 ${cmd}= Catenate set -o pipefail ; ${addr_translation_file_path} ${fir}
93 ... ${core_id} | grep -i ${target_type}
94 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050095 ${translated_addr}= Split String ${output} :${SPACE}0x
96 # Example output:
97 # 0x10010c00
98 [Return] ${translated_addr[1]}
George Keishinge7dc4472017-10-30 08:58:37 -050099
George Keishinge7dc4472017-10-30 08:58:37 -0500100Inject Error Through HOST
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600101 [Documentation] Inject checkstop on multiple targets like
102 ... CPU/CME/OCC/NPU/CAPP/MCA etc through HOST.
George Keishinge7dc4472017-10-30 08:58:37 -0500103 ... Test sequence:
104 ... 1. Boot To HOST
105 ... 2. Clear any existing gard records
106 ... 3. Inject Error on processor/centaur
107 [Arguments] ${fir} ${chip_address} ${threshold_limit}
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500108 ... ${master_proc_chip}=True
George Keishinge7dc4472017-10-30 08:58:37 -0500109 # Description of argument(s):
110 # fir FIR (Fault isolation register) value (e.g. 2011400).
111 # chip_address chip address (e.g 2000000000000000).
112 # threshold_limit Threshold limit (e.g 1, 5, 32).
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500113 # master_proc_chip Processor chip type (True' or 'False').
George Keishinge7dc4472017-10-30 08:58:37 -0500114
115 Delete Error Logs
116 Login To OS Host
117 Gard Operations On OS clear all
118
119 # Fetch processor chip IDs.
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500120 ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip}
George Keishinge7dc4472017-10-30 08:58:37 -0500121
122 ${threshold_limit}= Convert To Integer ${threshold_limit}
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600123 :FOR ${count} IN RANGE ${threshold_limit}
Sridevi Rameshcf4507c2017-10-26 04:13:50 -0500124 \ Run Keyword Putscom Operations On OS ${proc_chip_id} ${fir}
125 ... ${chip_address}
George Keishinge7dc4472017-10-30 08:58:37 -0500126 # Adding delay after each error injection.
127 \ Sleep 10s
128 # Adding delay to get error log after error injection.
129 Sleep 120s
130
George Keishinge7dc4472017-10-30 08:58:37 -0500131Code Update Unrecoverable Error Inject
132 [Documentation] Inject UE MCACALFIR checkstop on processor through
133 ... host during PNOR code update.
134
135 Inject Error Through HOST 05010800 4000000000000000 1
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600136
137Disable CPU States Through HOST
138 [Documentation] Disable CPU states through host.
139
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500140 # Fetch number of states present for cpu0.
141 ${cmd}= Catenate ls /sys/devices/system/cpu/cpu0/cpuidle|grep state|wc -l
Sridevi Ramesh70978ed2017-11-22 23:56:50 -0600142 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500143 ${no_of_states}= Convert To Integer ${output}
144
145 # Disable state for all cpus.
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600146 :FOR ${count} IN RANGE ${no_of_states}
Sridevi Rameshebe84e02018-03-13 06:52:48 -0500147 \ ${cmd}= Catenate SEPARATOR= for file_path in /sys/devices/system/cpu/
148 ... cpu*/cpuidle/state${i}/disable; do echo 1 > $file_path; done
149 \ ${output} ${stderr} ${rc}= Run Keyword OS Execute Command ${cmd}
Sridevi Rameshd079e9d2018-02-13 01:14:58 -0600150
151Is Opal-PRD Service Enabled
152 [Documentation] Check if Opal-PRD service is running & return either
153 ... 'enabled' or 'disabled'.
154
155 ${cmd}= Catenate systemctl list-unit-files | grep opal-prd
156 ${output} ${stderr} ${rc}= OS Execute Command ${cmd}
157 ${opal_prd_state}= Split String ${output}
158
159 # Example output from prior command:
160 # opal-prd.service enabled
161 [Return] ${opal_prd_state[1]}
162
163Enable Opal-PRD Service On HOST
164 [Documentation] Enable Opal-PRD service on host.
165
166 OS Execute Command service opal-prd start
167 ${opal_prd_state}= Is Opal-PRD Service Enabled
168 Should Contain ${opal_prd_state} enabled
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -0600169
170BMC Putscom
171 [Documentation] Executes putscom command through BMC.
172
173 [Arguments] ${proc_chip_id} ${fru} ${chip_address}
174
175 # Description of argument(s):
176 # proc_chip_id Processor ID (e.g '0', '8').
177 # fru FRU (field replaceable unit) (e.g. '2011400').
178 # chip_address Chip address (e.g. '4000000000000000').
179
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600180 ${cmd}= Catenate pdbg -d p9w -p${proc_chip_id} putscom 0x${fru} 0x${chip_address}
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -0600181
182 BMC Execute Command ${cmd}
Sridevi Ramesh1d85af02019-02-22 04:08:15 -0600183
184Inject Error Through BMC
185 [Documentation] Inject checkstop on multiple targets like
186 ... CPU/CME/OCC/NPU/CAPP/MCA etc through BMC.
187 ... Test sequence:
188 ... 1. Boot To HOST.
189 ... 2. Clear any existing gard records.
190 ... 3. Inject Error on processor/centaur.
191 [Arguments] ${fir} ${chip_address} ${threshold_limit}
192 ... ${master_proc_chip}=True
193 # Description of argument(s):
194 # fir FIR (Fault isolation register) value (e.g. '2011400').
195 # chip_address Chip address (e.g. '2000000000000000').
196 # threshold_limit Recoverable error threshold limit (e.g. '1', '5', '32').
197
198 Delete Error Logs
199 Login To OS Host
200 Gard Operations On OS clear all
201
202 ${threshold_limit}= Convert To Integer ${threshold_limit}
203 :FOR ${count} IN RANGE ${threshold_limit}
204 \ BMC Putscom 0 ${fir}
205 ... ${chip_address}
206 # Adding delay after each error injection.
207 \ Sleep 10s
208 # Adding delay to get error log after error injection.
209 Sleep 120s