blob: af0f51052d2e2b19fd2d538213140fedfde1530a [file] [log] [blame]
Sridevi Ramesh3a722eb2019-04-29 04:00:34 -05001*** Settings ***
2Documentation Utility for RAS test scenarios through HOST & BMC.
3
4Resource ../../lib/utils.robot
5Resource ../../lib/ras/host_utils.robot
6Resource ../../lib/resource.txt
7Resource ../../lib/state_manager.robot
8Resource ../../lib/boot_utils.robot
9Variables ../../lib/ras/variables.py
10Variables ../../data/variables.py
11Resource ../../lib/dump_utils.robot
12
13Library DateTime
14Library OperatingSystem
15Library random
16Library Collections
17
18*** Variables ***
19${stack_mode} normal
20
21*** Keywords ***
22
23Verify And Clear Gard Records On HOST
24 [Documentation] Verify And Clear gard records on HOST.
25
26 ${output}= Gard Operations On OS list
27 Should Not Contain ${output} No GARD
28 Gard Operations On OS clear all
29
30Verify Error Log Entry
31 [Documentation] Verify error log entry & signature description.
32 [Arguments] ${signature_desc} ${log_prefix}
33 # Description of argument(s):
34 # signature_desc Error log signature description.
35 # log_prefix Log path prefix.
36
37 # TODO: Need to move this keyword to common utility.
38
39 Error Logs Should Exist
40
41 Collect eSEL Log ${log_prefix}
42 ${error_log_file_path}= Catenate ${log_prefix}esel.txt
43 ${rc} ${output}= Run and Return RC and Output
44 ... grep -i ${signature_desc} ${error_log_file_path}
45 Should Be Equal ${rc} ${0}
46 Should Not Be Empty ${output}
47
48Inject Recoverable Error With Threshold Limit
49 [Documentation] Inject and verify recoverable error on processor through
50 ... BMC/HOST.
51 ... Test sequence:
52 ... 1. Inject recoverable error on a given target
53 ... (e.g: Processor core, CAPP MCA) through BMC/HOST.
54 ... 2. Check If HOST is running.
55 ... 3. Verify error log entry & signature description.
56 ... 4. Verify & clear gard records.
57 [Arguments] ${interface_type} ${fir} ${chip_address} ${threshold_limit}
58 ... ${signature_desc} ${log_prefix}
59 # Description of argument(s):
60 # interface_type Inject error through 'BMC' or 'HOST'.
61 # fir FIR (Fault isolation register) value (e.g. 2011400).
62 # chip_address Chip address (e.g 2000000000000000).
63 # threshold_limit Threshold limit (e.g 1, 5, 32).
64 # signature_desc Error log signature description.
65 # log_prefix Log path prefix.
66
67 Run Keyword If '${interface_type}' == 'HOST'
68 ... Inject Error Through HOST ${fir} ${chip_address} ${threshold_limit}
69 ... ${master_proc_chip}
70 ... ELSE
71 ... Inject Error Through BMC ${fir} ${chip_address} ${threshold_limit}
72 ... ${master_proc_chip}
73
74 Is Host Running
75 ${output}= Gard Operations On OS list
76 Should Contain ${output} No GARD
77 Verify Error Log Entry ${signature_desc} ${log_prefix}
78 # TODO: Verify SOL console logs.
79
80
81Inject Unrecoverable Error
82 [Documentation] Inject and verify unrecoverable error on processor through
83 ... BMC/HOST.
84 ... Test sequence:
85 ... 1. Inject unrecoverable error on a given target
86 ... (e.g: Processor core, CAPP MCA) through BMC/HOST.
87 ... 2. Check If HOST is rebooted.
88 ... 3. Verify & clear gard records.
89 ... 4. Verify error log entry & signature description.
90 ... 5. Verify & clear dump entry.
91 [Arguments] ${interface_type} ${fir} ${chip_address} ${threshold_limit}
92 ... ${signature_desc} ${log_prefix}
93 # Description of argument(s):
94 # interface_type Inject error through 'BMC' or 'HOST'.
95 # fir FIR (Fault isolation register) value (e.g. 2011400).
96 # chip_address Chip address (e.g 2000000000000000).
97 # threshold_limit Threshold limit (e.g 1, 5, 32).
98 # signature_desc Error Log signature description.
99 # (e.g 'mcs(n0p0c0) (MCFIR[0]) mc internal recoverable')
100 # log_prefix Log path prefix.
101
102 Run Keyword If '${interface_type}' == 'HOST'
103 ... Inject Error Through HOST ${fir} ${chip_address} ${threshold_limit}
104 ... ${master_proc_chip}
105 ... ELSE
106 ... Inject Error Through BMC ${fir} ${chip_address} ${threshold_limit}
107 ... ${master_proc_chip}
108
109 Wait Until Keyword Succeeds 500 sec 20 sec Is Host Rebooted
110 Wait for OS
111 Verify Error Log Entry ${signature_desc} ${log_prefix}
112 ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}list
113 Should Not Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
114 Delete All BMC Dump
115 Verify And Clear Gard Records On HOST
116
117Fetch FIR Address Translation Value
118 [Documentation] Fetch FIR address translation value through HOST.
119 [Arguments] ${fir} ${target_type}
120 # Description of argument(s):
121 # fir FIR (Fault isolation register) value (e.g. '2011400').
122 # core_id Core ID (e.g. '9').
123 # target_type Target type (e.g. 'EX', 'EQ', 'C').
124
125 Login To OS Host
126 Copy Address Translation Utils To HOST OS
127
128 # Fetch processor chip IDs.
129 ${proc_chip_id}= Get ProcChipId From OS Processor ${master_proc_chip}
130 # Example output:
131 # 00000000
132
133 ${core_ids}= Get Core IDs From OS ${proc_chip_id[-1]}
134 # Example output:
135 #./probe_cpus.sh | grep 'CHIP ID: 0' | cut -c21-22
136 # ['14', '15', '16', '17']
137
138 # Ignoring master core ID.
139 ${output}= Get Slice From List ${core_ids} 1
140 # Feth random non-master core ID.
141 ${core_ids_sub_list}= Evaluate random.sample(${core_ids}, 1) random
142 ${core_id}= Get From List ${core_ids_sub_list} 0
143 ${translated_fir_addr}= FIR Address Translation Through HOST
144 ... ${fir} ${core_id} ${target_type}
145
146 [Return] ${translated_fir_addr}
147
148RAS Test SetUp
149 [Documentation] Validates input parameters.
150
151 Should Not Be Empty
152 ... ${OS_HOST} msg=You must provide DNS name/IP of the OS host.
153 Should Not Be Empty
154 ... ${OS_USERNAME} msg=You must provide OS host user name.
155 Should Not Be Empty
156 ... ${OS_PASSWORD} msg=You must provide OS host user password.
157
158 # Boot to OS.
159 REST Power On quiet=${1}
160 # Adding delay after host bring up.
161 Sleep 60s
162
163RAS Suite Setup
164 [Documentation] Create RAS log directory to store all RAS test logs.
165
166 ${RAS_LOG_DIR_PATH}= Catenate ${EXECDIR}/RAS_logs/
167 Set Suite Variable ${RAS_LOG_DIR_PATH}
168 Set Suite Variable ${master_proc_chip} False
169
170 Create Directory ${RAS_LOG_DIR_PATH}
171 OperatingSystem.Directory Should Exist ${RAS_LOG_DIR_PATH}
172 Empty Directory ${RAS_LOG_DIR_PATH}
173
174 Should Not Be Empty ${ESEL_BIN_PATH}
175 Set Environment Variable PATH %{PATH}:${ESEL_BIN_PATH}
176
177 # Boot to Os.
178 REST Power On quiet=${1}
179
180 # Check Opal-PRD service enabled on host.
181 ${opal_prd_state}= Is Opal-PRD Service Enabled
182 Run Keyword If '${opal_prd_state}' == 'disabled'
183 ... Enable Opal-PRD Service On HOST
184
185RAS Suite Cleanup
186 [Documentation] Perform RAS suite cleanup and verify that host
187 ... boots after test suite run.
188
189 # Boot to OS.
190 REST Power On quiet=${1}
191 Delete Error Logs
192 Gard Operations On OS clear all