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 |
| 8 | |
| 9 | *** Keywords *** |
| 10 | |
| 11 | Getscom Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 12 | [Documentation] Executes getscom command on OS with the given |
| 13 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 14 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 15 | # Description of arguments: |
| 16 | # input_cmd -l|--list-chips |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 17 | # -c|--chip <chip-id> <addr> |
| 18 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 19 | ${output} ${stderr} ${rc}= OS Execute Command getscom ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 20 | Should Be Empty ${stderr} |
| 21 | [Return] ${output} |
| 22 | |
| 23 | Gard Operations On OS |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 24 | [Documentation] Executes opal-gard command on OS with the given |
| 25 | ... input command. |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 26 | [Arguments] ${input_cmd} |
Sridevi Ramesh | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 27 | # Description of arguments: |
| 28 | # input_cmd list/clear all/show <gard_record_id> |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 29 | |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 30 | ${output} ${stderr} ${rc}= OS Execute Command opal-gard ${input_cmd} |
Sridevi Ramesh | 0c8c4ce | 2017-02-11 01:28:36 -0600 | [diff] [blame] | 31 | Should Be Empty ${stderr} |
| 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 | ea36b41 | 2017-03-09 04:08:02 -0600 | [diff] [blame] | 48 | [Arguments] ${chip_type} |
| 49 | # Description of arguments: |
| 50 | # chip_type The chip type (Processor/Centaur). |
| 51 | |
| 52 | ${cmd}= Catenate -l | grep -i ${chip_type} | cut -c1-8 |
Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 53 | ${proc_chip_id}= Getscom Operations On OS ${cmd} |
| 54 | # Example output: |
| 55 | # 00000008 |
| 56 | # 00000000 |
| 57 | [Return] ${proc_chip_id} |
| 58 | |
| 59 | Get Core IDs From OS |
| 60 | [Documentation] Get Core IDs corresponding to the input processor chip ID. |
| 61 | [Arguments] ${proc_chip_id} |
| 62 | # Description of argument(s): |
| 63 | # proc_chip_id Processor ID (e.g '0', '8'). |
| 64 | |
| 65 | ${cmd}= Catenate set -o pipefail ; ${probe_cpu_file_path} |
| 66 | ... | grep -i 'CHIP ID: ${proc_chip_id}' | cut -c21-22 |
| 67 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 68 | Should Be Empty ${stderr} |
| 69 | ${core_ids}= Split String ${output} |
| 70 | # Example output: |
| 71 | # ['2', '3', '4', '5', '6'] |
| 72 | [Return] ${core_ids} |
| 73 | |
| 74 | FIR Address Translation Through HOST |
| 75 | [Documentation] Do FIR address translation through host for given FIR, |
| 76 | ... core value & target type. |
| 77 | [Arguments] ${fir} ${core_id} ${target_type} |
| 78 | # Description of argument(s): |
| 79 | # fir FIR (Fault isolation register) value (e.g. 2011400). |
| 80 | # core_id Core ID (e.g. 9). |
| 81 | # target_type Target type (e.g. 'EQ', 'EX', 'C'). |
| 82 | |
| 83 | ${cmd}= Catenate set -o pipefail ; ${addr_translation_file_path} ${fir} |
| 84 | ... ${core_id} | grep -i ${target_type} |
| 85 | ${output} ${stderr} ${rc}= OS Execute Command ${cmd} |
| 86 | Should Be Empty ${stderr} |
| 87 | ${translated_addr}= Split String ${output} :${SPACE}0x |
| 88 | # Example output: |
| 89 | # 0x10010c00 |
| 90 | [Return] ${translated_addr[1]} |