blob: e68181e60f792906e372e754cccf850f468c395e [file] [log] [blame]
George Keishing4346a412016-07-19 11:26:49 -05001#!/usr/bin/python
Gunnar Millsa812e0f2016-09-29 20:30:03 -05002r"""
George Keishing4346a412016-07-19 11:26:49 -05003#############################################################
4# @file openbmc_ffdc_list.py
George Keishing4346a412016-07-19 11:26:49 -05005#
6# @brief List for FFDC ( First failure data capture )
7# commands and files to be collected as a part
8# of the test case failure.
9#############################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -050010"""
George Keishing4346a412016-07-19 11:26:49 -050011
Gunnar Millsa812e0f2016-09-29 20:30:03 -050012# -------------------
George Keishing4346a412016-07-19 11:26:49 -050013# FFDC default list
Gunnar Millsa812e0f2016-09-29 20:30:03 -050014# -------------------
George Keishing4346a412016-07-19 11:26:49 -050015
Gunnar Millsa812e0f2016-09-29 20:30:03 -050016# -----------------------------------------------------------------
17# Dict Name { Index string : { Key String : Comand string} }
18# -----------------------------------------------------------------
George Keishing69e6f712016-09-12 06:30:09 -050019# Add cmd's needed to be part of the ffdc report manifest file
20FFDC_BMC_CMD = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050021 'DRIVER INFO':
22 {
23 # String Name Command
24 'Build Info': 'cat /etc/version',
25 'FW Level': 'cat /etc/os-release',
26 },
27 'BMC DATA':
28 {
29 'BMC OS': 'uname -a',
30 'BMC Uptime': 'uptime',
Gunnar Millsa812e0f2016-09-29 20:30:03 -050031 'BMC File System Disk Space Usage': 'df -hT',
32 },
33 'APPLICATION DATA':
34 {
35 'BMC state': '/usr/sbin/obmcutil state',
36 },
37}
George Keishing4346a412016-07-19 11:26:49 -050038
George Keishing69e6f712016-09-12 06:30:09 -050039# Add file name and correcponding command needed for BMC
40FFDC_BMC_FILE = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050041 'BMC FILES':
42 {
43 # File Name Command
44 'BMC_proc_list': 'top -n 1 -b',
Gunnar Millsaca140d2016-10-26 13:05:10 -050045 'BMC_journalctl': 'journalctl --no-pager',
Gunnar Millsa812e0f2016-09-29 20:30:03 -050046 'BMC_dmesg': 'dmesg',
Gunnar Millsaca140d2016-10-26 13:05:10 -050047 'BMC_procinfo': 'cat /proc/cpuinfo',
48 'BMC_meminfo': 'cat /proc/meminfo',
Gunnar Millsa812e0f2016-09-29 20:30:03 -050049 },
50}
51
Gunnar Mills7e2cda22016-10-11 15:37:34 -050052# Add file name and correcponding command needed for all Linux distributions
53FFDC_OS_ALL_DISTROS_FILE = {
54 'OS FILES':
55 {
56 # File Name Command
57 'OS_msglog': 'cat /sys/firmware/opal/msglog',
58 'OS_cpufrequency': 'ppc64_cpu --frequency',
59 'OS_dmesg': 'dmesg',
60 'OS_boot': 'cat /var/log/boot.log',
Gunnar Millsaca140d2016-10-26 13:05:10 -050061 'OS_procinfo': 'cat /proc/cpuinfo',
62 'OS_meminfo': 'cat /proc/meminfo',
63 'OS_netstat': 'netstat -a',
Gunnar Mills7e2cda22016-10-11 15:37:34 -050064 },
65}
66
Gunnar Millscce185d2016-10-17 17:04:15 -050067# Add file name and correcponding command needed for Ubuntu Linux
68FFDC_OS_UBUNTU_FILE = {
69 'OS FILES':
70 {
71 # File Name Command
72 'OS_isusb': 'lsusb -t ; lsusb -v',
73 'OS_kern': 'tail -n 50000 /var/log/kern.log',
74 'OS_authlog': 'cat /var/log/auth.log; cat /var/log/auth.log.1',
75 'OS_syslog': 'tail -n 200000 /var/log/syslog',
76 'OS_info': 'uname -a; dpkg -s opal-prd; dpkg -s ipmitool',
77 },
78}
79
80# Add file name and correcponding command needed for RHEL Linux
81FFDC_OS_RHEL_FILE = {
82 'OS FILES':
83 {
84 # File Name Command
85 'OS_rsct': '/usr/bin/ctversion -bv',
86 'OS_secure': 'cat /var/log/secure',
87 'OS_syslog': 'tail -n 200000 /var/log/messages',
88 'OS_info': 'lsb_release -a; cat /etc/redhat-release; uname -a; rpm -qa',
89 },
90}
91
92# Add file name and correcponding command needed for RHEL Linux
93FFDC_OS_IBM_POWERKVM_FILE = {
94 'OS FILES':
95 {
96 # File Name Command
97 'OS_secure': 'cat /var/log/secure',
98 'OS_syslog': 'tail -n 200000 /var/log/messages',
99 'OS_info': 'lsb_release -a; uname -a; rpm -qa',
100 },
101}
102
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500103# Add file name and correcponding Get Request
104FFDC_GET_REQUEST = {
105 'GET REQUESTS':
106 {
107 # File Name Command
108 'BMC_sensor_list': '/org/openbmc/sensors/enumerate',
109 'BMC_inventory': '/org/openbmc/inventory/system/enumerate',
110 'BMC_led': '/org/openbmc/control/led/enumerate',
111 'BMC_record_log': '/org/openbmc/records/events/enumerate',
112 },
113}
114
George Keishing69e6f712016-09-12 06:30:09 -0500115
116# Define your keywords in method/utils and call here
117FFDC_METHOD_CALL = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500118 'BMC LOGS':
119 {
120 # Description Keyword name
121 'FFDC Generic Report': 'BMC FFDC Manifest',
122 'BMC Specific Files': 'BMC FFDC Files',
123 'Get Request FFDC': 'BMC FFDC Get Requests',
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500124 'OS FFDC': 'OS FFDC Files',
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500125 },
126}
George Keishing4346a412016-07-19 11:26:49 -0500127
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500128# -----------------------------------------------------------------
George Keishing4346a412016-07-19 11:26:49 -0500129
130
131# base class for FFDC default list
132class openbmc_ffdc_list():
133
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500134 def get_ffdc_bmc_cmd(self, i_type):
135 r"""
136 ########################################################################
137 # @brief This method returns the list from the dictionary for cmds
138 # @param i_type: @type string: string index lookup
139 # @return List of key pair from the dictionary
140 ########################################################################
141 """
George Keishing69e6f712016-09-12 06:30:09 -0500142 return FFDC_BMC_CMD[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500143
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500144 def get_ffdc_bmc_file(self, i_type):
145 r"""
146 ########################################################################
147 # @brief This method returns the list from the dictionary for scp
148 # @param i_type: @type string: string index lookup
149 # @return List of key pair from the dictionary
150 ########################################################################
151 """
George Keishing69e6f712016-09-12 06:30:09 -0500152 return FFDC_BMC_FILE[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500153
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500154 def get_ffdc_get_request(self, i_type):
155 r"""
156 ########################################################################
157 # @brief This method returns the list from the dictionary for scp
158 # @param i_type: @type string: string index lookup
159 # @return List of key pair from the dictionary
160 ########################################################################
161 """
162 return FFDC_GET_REQUEST[i_type].items()
163
George Keishing69e6f712016-09-12 06:30:09 -0500164 def get_ffdc_cmd_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500165 r"""
166 ########################################################################
167 # @brief This method returns the list index from dictionary
168 # @return List of index to the dictionary
169 ########################################################################
170 """
George Keishing69e6f712016-09-12 06:30:09 -0500171 return FFDC_BMC_CMD.keys()
172
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500173 def get_ffdc_get_request_index(self):
174 r"""
175 ########################################################################
176 # @brief This method returns the list index from dictionary
177 # @return List of index to the dictionary
178 ########################################################################
179 """
180 return FFDC_GET_REQUEST.keys()
181
George Keishing69e6f712016-09-12 06:30:09 -0500182 def get_ffdc_file_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500183 r"""
184 ########################################################################
185 # @brief This method returns the list index from dictionary
186 # @return List of index to the dictionary
187 ########################################################################
188 """
George Keishing69e6f712016-09-12 06:30:09 -0500189 return FFDC_BMC_FILE.keys()
190
George Keishing69e6f712016-09-12 06:30:09 -0500191 def get_ffdc_method_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500192 r"""
193 ########################################################################
194 # @brief This method returns the key pair from the dictionary
195 # @return Index of the method dictionary
196 ########################################################################
197 """
George Keishing69e6f712016-09-12 06:30:09 -0500198 return FFDC_METHOD_CALL.keys()
199
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500200 def get_ffdc_method_call(self, i_type):
201 r"""
202 ########################################################################
203 # @brief This method returns the key pair from the dictionary
204 # @return List of key pair keywords
205 ########################################################################
206 """
George Keishing69e6f712016-09-12 06:30:09 -0500207 return FFDC_METHOD_CALL[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500208
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500209 def get_ffdc_os_all_distros_index(self):
210 r"""
211 ########################################################################
212 # @brief This method returns the key pair from the dictionary
213 # @return Index of the method dictionary
214 ########################################################################
215 """
216 return FFDC_OS_ALL_DISTROS_FILE.keys()
217
218 def get_ffdc_os_all_distros_call(self, i_type):
219 r"""
220 ########################################################################
221 # @brief This method returns the key pair from the dictionary
222 # @return List of key pair keywords
223 ########################################################################
224 """
225 return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
226
Gunnar Millscce185d2016-10-17 17:04:15 -0500227 def get_ffdc_os_distro_index(self, distro):
228 r"""
229 ########################################################################
230 # @brief This method returns the key pair from the dictionary
231 # @return Index of the method dictionary
232 ########################################################################
233 """
234 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
235 return eval(distro_file).keys()
236
237 def get_ffdc_os_distro_call(self, i_type, distro):
238 r"""
239 ########################################################################
240 # @brief This method returns the key pair from the dictionary
241 # @return List of key pair keywords
242 ########################################################################
243 """
244 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
245 return eval(distro_file)[i_type].items()
246
George Keishing4346a412016-07-19 11:26:49 -0500247 def get_strip_string(self, i_str):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500248 r"""
249 ########################################################################
250 # @brief Returns the stripped strings
251 # @param i_str: @type string: string name
252 # @return Remove all special chars and return the string
253 ########################################################################
254 """
George Keishing4346a412016-07-19 11:26:49 -0500255 return ''.join(e for e in i_str if e.isalnum())