Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This module is for OS checkstop opertions. |
| 3 | Resource ../../lib/rest_client.robot |
| 4 | Resource ../../lib/utils.robot |
George Keishing | 8756743 | 2017-10-24 03:48:13 -0500 | [diff] [blame] | 5 | Variables ../../lib/ras/variables.py |
| 6 | Library ../../lib/bmc_ssh_utils.py |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 7 | Library OperatingSystem |
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 | |
| 11 | *** Keywords *** |
| 12 | |
| 13 | Getscom Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 14 | [Documentation] Executes getscom command on OS with the given |
| 15 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 16 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 17 | # Description of arguments: |
| 18 | # input_cmd -l|--list-chips |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 19 | # -c|--chip <chip-id> <addr> |
| 20 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 21 | ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 22 | [Return] ${output} |
| 23 | |
| 24 | Gard Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 25 | [Documentation] Executes opal-gard command on OS with the given |
| 26 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 27 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 28 | # Description of arguments: |
| 29 | # input_cmd list/clear all/show <gard_record_id> |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 30 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 31 | ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 32 | [Return] ${output} |
| 33 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 34 | Putscom Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 35 | [Documentation] Executes putscom command on OS with the given |
| 36 | ... input arguments. |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 37 | [Arguments] ${proc_chip_id} ${fru} ${address} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 38 | # Description of arguments: |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 39 | # proc_chip_id Processor ID (e.g '0', '8'). |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 40 | # fru FRU value (e.g. 2011400). |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 41 | # address Chip address (e.g 4000000000000000). |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 42 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 43 | ${cmd}= Catenate putscom -c 0x${proc_chip_id} 0x${fru} 0x${address} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 44 | Start Command ${cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 45 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 46 | Get ProcChipId From OS |
| 47 | [Documentation] Get processor chip ID values based on the input. |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 48 | [Arguments] ${chip_type} ${master_proc_chip} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 49 | # Description of arguments: |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 50 | # chip_type The chip type (Processor/Centaur). |
| 51 | # master_proc_chip Processor chip type ('True' or 'False'). |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 52 | |
| 53 | ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8 |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 54 | ${proc_chip_id}= Getscom Operations On OS ${cmd} |
| 55 | # Example output: |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 56 | # 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 Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 66 | # 00000008 |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 67 | [Return] ${proc_id} |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 68 | |
| 69 | Get 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 Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 78 | ${core_ids}= Split String ${output} |
| 79 | # Example output: |
| 80 | # ['2', '3', '4', '5', '6'] |
| 81 | [Return] ${core_ids} |
| 82 | |
| 83 | FIR 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 Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 95 | ${translated_addr}= Split String ${output} :${SPACE}0x |
| 96 | # Example output: |
| 97 | # 0x10010c00 |
| 98 | [Return] ${translated_addr[1]} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 99 | |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 100 | Inject Error Through HOST |
| 101 | [Documentation] Inject checkstop on processor through HOST. |
| 102 | ... Test sequence: |
| 103 | ... 1. Boot To HOST |
| 104 | ... 2. Clear any existing gard records |
| 105 | ... 3. Inject Error on processor/centaur |
| 106 | [Arguments] ${fir} ${chip_address} ${threshold_limit} |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 107 | ... ${master_proc_chip}=True |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 108 | # Description of argument(s): |
| 109 | # fir FIR (Fault isolation register) value (e.g. 2011400). |
| 110 | # chip_address chip address (e.g 2000000000000000). |
| 111 | # threshold_limit Threshold limit (e.g 1, 5, 32). |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 112 | # master_proc_chip Processor chip type (True' or 'False'). |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 113 | |
| 114 | Delete Error Logs |
| 115 | Login To OS Host |
| 116 | Gard Operations On OS clear all |
| 117 | |
| 118 | # Fetch processor chip IDs. |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 119 | ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 120 | |
| 121 | ${threshold_limit}= Convert To Integer ${threshold_limit} |
| 122 | :FOR ${i} IN RANGE ${threshold_limit} |
Sridevi Ramesh | cf4507c | 2017-10-26 04:13:50 -0500 | [diff] [blame] | 123 | \ Run Keyword Putscom Operations On OS ${proc_chip_id} ${fir} |
| 124 | ... ${chip_address} |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 125 | # Adding delay after each error injection. |
| 126 | \ Sleep 10s |
| 127 | # Adding delay to get error log after error injection. |
| 128 | Sleep 120s |
| 129 | |
George Keishing | e7dc447 | 2017-10-30 08:58:37 -0500 | [diff] [blame] | 130 | Code Update Unrecoverable Error Inject |
| 131 | [Documentation] Inject UE MCACALFIR checkstop on processor through |
| 132 | ... host during PNOR code update. |
| 133 | |
| 134 | Inject Error Through HOST 05010800 4000000000000000 1 |
Sridevi Ramesh | 70978ed | 2017-11-22 23:56:50 -0600 | [diff] [blame] | 135 | |
| 136 | Disable CPU States Through HOST |
| 137 | [Documentation] Disable CPU states through host. |
| 138 | |
Sridevi Ramesh | ebe84e0 | 2018-03-13 06:52:48 -0500 | [diff] [blame] | 139 | # Fetch number of states present for cpu0. |
| 140 | ${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] | 141 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
Sridevi Ramesh | ebe84e0 | 2018-03-13 06:52:48 -0500 | [diff] [blame] | 142 | ${no_of_states}= Convert To Integer ${output} |
| 143 | |
| 144 | # Disable state for all cpus. |
| 145 | :FOR ${i} IN RANGE ${no_of_states} |
| 146 | \ ${cmd}= Catenate SEPARATOR= for file_path in /sys/devices/system/cpu/ |
| 147 | ... cpu*/cpuidle/state${i}/disable; do echo 1 > $file_path; done |
| 148 | \ ${output} ${stderr} ${rc}= Run Keyword OS Execute Command ${cmd} |
Sridevi Ramesh | d079e9d | 2018-02-13 01:14:58 -0600 | [diff] [blame] | 149 | |
| 150 | Is Opal-PRD Service Enabled |
| 151 | [Documentation] Check if Opal-PRD service is running & return either |
| 152 | ... 'enabled' or 'disabled'. |
| 153 | |
| 154 | ${cmd}= Catenate systemctl list-unit-files | grep opal-prd |
| 155 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 156 | ${opal_prd_state}= Split String ${output} |
| 157 | |
| 158 | # Example output from prior command: |
| 159 | # opal-prd.service enabled |
| 160 | [Return] ${opal_prd_state[1]} |
| 161 | |
| 162 | Enable Opal-PRD Service On HOST |
| 163 | [Documentation] Enable Opal-PRD service on host. |
| 164 | |
| 165 | OS Execute Command service opal-prd start |
| 166 | ${opal_prd_state}= Is Opal-PRD Service Enabled |
| 167 | Should Contain ${opal_prd_state} enabled |