Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 1 | *** Settings *** |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 2 | Documentation Utility for error injection scenarios through HOST & BMC. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 3 | Resource ../../lib/rest_client.robot |
| 4 | Resource ../../lib/utils.robot |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 5 | Resource ../../lib/common_utils.robot |
George Keishing | 8756743 | 2017-10-24 03:48:13 -0500 | [diff] [blame] | 6 | Variables ../../lib/ras/variables.py |
| 7 | Library ../../lib/bmc_ssh_utils.py |
Sridevi Ramesh | 70978ed | 2017-11-22 23:56:50 -0600 | [diff] [blame] | 8 | Library ../../lib/gen_print.py |
| 9 | Library ../../lib/gen_robot_print.py |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 10 | |
Sridevi Ramesh | 9c6ec28 | 2019-03-25 03:35:46 -0500 | [diff] [blame] | 11 | Library OperatingSystem |
| 12 | |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 13 | *** Keywords *** |
| 14 | |
| 15 | Getscom Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 16 | [Documentation] Executes getscom command on OS with the given |
| 17 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 18 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 19 | # Description of arguments: |
| 20 | # input_cmd -l|--list-chips |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 21 | # -c|--chip <chip-id> <addr> |
| 22 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 23 | ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 24 | [Return] ${output} |
| 25 | |
| 26 | Gard Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 27 | [Documentation] Executes opal-gard command on OS with the given |
| 28 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 29 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 30 | # Description of arguments: |
| 31 | # input_cmd list/clear all/show <gard_record_id> |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 32 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 33 | ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 34 | [Return] ${output} |
| 35 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 36 | Putscom Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 37 | [Documentation] Executes putscom command on OS with the given |
| 38 | ... input arguments. |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 39 | [Arguments] ${proc_chip_id} ${fir_address} ${value} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 40 | # Description of arguments: |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 41 | # proc_chip_id Processor ID (e.g '0', '8'). |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 42 | # fir_address FIR (Fault isolation register) value (e.g. 2011400). |
| 43 | # value (e.g 4000000000000000). |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 44 | |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 45 | ${cmd}= Catenate putscom -c 0x${proc_chip_id} 0x${fir_address} 0x${value} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 46 | Start Command ${cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 47 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 48 | Get ProcChipId From OS |
| 49 | [Documentation] Get processor chip ID values based on the input. |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 50 | [Arguments] ${chip_type} ${master_proc_chip} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 51 | # Description of arguments: |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 52 | # chip_type The chip type (Processor/Centaur). |
| 53 | # master_proc_chip Processor chip type ('True' or 'False'). |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 54 | |
| 55 | ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8 |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 56 | ${proc_chip_id}= Getscom Operations On OS ${cmd} |
| 57 | # Example output: |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 58 | # 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' |
| 64 | \ ... Get From List ${proc_ids} 1 |
| 65 | \ ... ELSE Get From List ${proc_ids} 0 |
| 66 | |
| 67 | # Example output: |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 68 | # 00000008 |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 69 | [Return] ${proc_id} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 70 | |
| 71 | Get 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 Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 80 | ${core_ids}= Split String ${output} |
| 81 | # Example output: |
| 82 | # ['2', '3', '4', '5', '6'] |
| 83 | [Return] ${core_ids} |
| 84 | |
| 85 | FIR Address Translation Through HOST |
| 86 | [Documentation] Do FIR address translation through host for given FIR, |
| 87 | ... core value & target type. |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 88 | [Arguments] ${fir_address} ${core_id} ${target_type} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 89 | # Description of argument(s): |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 90 | # 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 Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 93 | |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 94 | ${cmd}= Catenate set -o pipefail ; ${addr_translation_file_path} ${fir_address} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 95 | ... ${core_id} | grep -i ${target_type} |
| 96 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 97 | ${translated_addr}= Split String ${output} :${SPACE}0x |
| 98 | # Example output: |
| 99 | # 0x10010c00 |
| 100 | [Return] ${translated_addr[1]} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 101 | |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 102 | Inject Error Through HOST |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 103 | [Documentation] Inject checkstop on multiple targets like |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 104 | ... CPU/CME/OCC/NPU/CAPP/MCA etc. through HOST. |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 105 | ... Test sequence: |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 106 | ... 1. Boot To HOST. |
| 107 | ... 2. Clear any existing gard records. |
| 108 | ... 3. Inject Error on processor. |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 109 | [Arguments] ${fir_address} ${value} ${threshold_limit} |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 110 | ... ${master_proc_chip}=True |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 111 | # Description of argument(s): |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 112 | # fir_address FIR (Fault isolation register) value (e.g. 2011400). |
| 113 | # value (e.g 2000000000000000). |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 114 | # threshold_limit Threshold limit (e.g 1, 5, 32). |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 115 | # master_proc_chip Processor chip type (True' or 'False'). |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 116 | |
| 117 | Delete Error Logs |
| 118 | Login To OS Host |
Sridevi Ramesh | 9c6ec28 | 2019-03-25 03:35:46 -0500 | [diff] [blame] | 119 | Set Auto Reboot 1 |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 120 | Gard Operations On OS clear all |
| 121 | |
| 122 | # Fetch processor chip IDs. |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 123 | ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 124 | |
| 125 | ${threshold_limit}= Convert To Integer ${threshold_limit} |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 126 | :FOR ${count} IN RANGE ${threshold_limit} |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 127 | \ Run Keyword Putscom Operations On OS ${proc_chip_id} ${fir_address} |
| 128 | ... ${value} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 129 | # Adding delay after each error injection. |
| 130 | \ Sleep 10s |
| 131 | # Adding delay to get error log after error injection. |
| 132 | Sleep 120s |
| 133 | |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 134 | Code Update Unrecoverable Error Inject |
| 135 | [Documentation] Inject UE MCACALFIR checkstop on processor through |
| 136 | ... host during PNOR code update. |
| 137 | |
| 138 | Inject Error Through HOST 05010800 4000000000000000 1 |
Sridevi Ramesh | 70978ed | 2017-11-22 23:56:50 -0600 | [diff] [blame] | 139 | |
| 140 | Disable CPU States Through HOST |
| 141 | [Documentation] Disable CPU states through host. |
| 142 | |
Sridevi Ramesh | ebe84e0 | 2018-03-13 06:52:48 -0500 | [diff] [blame] | 143 | # Fetch number of states present for cpu0. |
| 144 | ${cmd}= Catenate ls /sys/devices/system/cpu/cpu0/cpuidle|grep state|wc -l |
Sridevi Ramesh | 70978ed | 2017-11-22 23:56:50 -0600 | [diff] [blame] | 145 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
Sridevi Ramesh | ebe84e0 | 2018-03-13 06:52:48 -0500 | [diff] [blame] | 146 | ${no_of_states}= Convert To Integer ${output} |
| 147 | |
| 148 | # Disable state for all cpus. |
Sridevi Ramesh | 76bc9ab | 2019-11-07 09:32:16 -0600 | [diff] [blame] | 149 | FOR ${count} IN RANGE ${no_of_states} |
| 150 | ${cmd}= Catenate SEPARATOR= for file_path in /sys/devices/system/cpu/ |
| 151 | ... cpu*/cpuidle/state${count}/disable; do echo 1 > $file_path; done |
| 152 | ${output} ${stderr} ${rc}= Run Keyword OS Execute Command ${cmd} |
| 153 | END |
Sridevi Ramesh | d079e9d | 2018-02-13 01:14:58 -0600 | [diff] [blame] | 154 | |
| 155 | Is Opal-PRD Service Enabled |
| 156 | [Documentation] Check if Opal-PRD service is running & return either |
| 157 | ... 'enabled' or 'disabled'. |
| 158 | |
| 159 | ${cmd}= Catenate systemctl list-unit-files | grep opal-prd |
| 160 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 161 | ${opal_prd_state}= Split String ${output} |
| 162 | |
| 163 | # Example output from prior command: |
| 164 | # opal-prd.service enabled |
| 165 | [Return] ${opal_prd_state[1]} |
| 166 | |
| 167 | Enable Opal-PRD Service On HOST |
| 168 | [Documentation] Enable Opal-PRD service on host. |
| 169 | |
| 170 | OS Execute Command service opal-prd start |
| 171 | ${opal_prd_state}= Is Opal-PRD Service Enabled |
| 172 | Should Contain ${opal_prd_state} enabled |
Sridevi Ramesh | 0e4d887 | 2019-01-10 09:06:58 -0600 | [diff] [blame] | 173 | |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 174 | |
| 175 | Inject Error Through BMC |
| 176 | [Documentation] Inject checkstop on multiple targets like |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 177 | ... CPU/CME/OCC/NPU/CAPP/MCA etc. through BMC. |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 178 | ... Test sequence: |
| 179 | ... 1. Boot To HOST. |
| 180 | ... 2. Clear any existing gard records. |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 181 | ... 3. Inject Error on processor. |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 182 | [Arguments] ${fir_address} ${value} ${threshold_limit} |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 183 | ... ${master_proc_chip}=True |
| 184 | # Description of argument(s): |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 185 | # fir_address FIR (Fault isolation register) value (e.g. '2011400'). |
| 186 | # value (e.g. '2000000000000000'). |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 187 | # threshold_limit Recoverable error threshold limit (e.g. '1', '5', '32'). |
| 188 | |
| 189 | Delete Error Logs |
| 190 | Login To OS Host |
Sridevi Ramesh | 9c6ec28 | 2019-03-25 03:35:46 -0500 | [diff] [blame] | 191 | Set Auto Reboot 1 |
| 192 | |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 193 | Gard Operations On OS clear all |
| 194 | |
| 195 | ${threshold_limit}= Convert To Integer ${threshold_limit} |
| 196 | :FOR ${count} IN RANGE ${threshold_limit} |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 197 | \ Pdbg -p0 putscom 0x${fir_address} 0x${value} |
Sridevi Ramesh | 1d85af0 | 2019-02-22 04:08:15 -0600 | [diff] [blame] | 198 | # Adding delay after each error injection. |
| 199 | \ Sleep 10s |
| 200 | # Adding delay to get error log after error injection. |
| 201 | Sleep 120s |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 202 | |
| 203 | |
| 204 | Inject Error Through BMC At HOST Boot |
| 205 | [Documentation] Inject error on multiple targets like |
| 206 | ... CPU/CME/OCC/NPU/CAPP/MCA etc. through BMC at HOST Boot. |
| 207 | ... Test sequence: |
| 208 | ... 1. Boot To HOST. |
| 209 | ... 2. Clear any existing gard records. |
| 210 | ... 3. Power off HOST and Boot. |
| 211 | ... 4. Inject Error on processor through BMC. |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 212 | [Arguments] ${fir_address} ${value} |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 213 | # Description of argument(s): |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 214 | # fir_address FIR (Fault isolation register) value (e.g. '2011400'). |
| 215 | # value (e.g. '2000000000000000'). |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 216 | |
| 217 | Delete Error Logs |
| 218 | |
| 219 | REST Power On stack_mode=skip |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 220 | |
| 221 | Gard Operations On OS clear all |
| 222 | |
| 223 | REST Power Off |
Sridevi Ramesh | b42a06e | 2019-07-23 06:39:23 -0500 | [diff] [blame] | 224 | Set Auto Reboot 1 |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 225 | Initiate Host Boot wait=${0} |
| 226 | |
| 227 | Start SOL Console Logging ${EXECDIR}/esol.log |
| 228 | |
| 229 | Wait Until Keyword Succeeds 5 min 5 sec |
| 230 | ... Shell Cmd grep 'ISTEP *14' ${EXECDIR}/esol.log quiet=1 |
| 231 | ... print_output=0 show_err=0 ignore_err=0 |
| 232 | |
Sridevi Ramesh | 9617ebd | 2019-11-25 10:57:21 -0600 | [diff] [blame] | 233 | Pdbg -p0 putscom 0x${fir_address} 0x${value} |
Sridevi Ramesh | 3e2a3bd | 2019-05-09 05:30:53 -0500 | [diff] [blame] | 234 | # Adding delay to get error log after error injection. |
| 235 | Sleep 10s |
| 236 | |
| 237 | Stop SOL Console Logging |