blob: 0e36d7022c5339891c019dbd0e03540bf57fbc57 [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',
31 'BMC Proc Info': 'cat /proc/cpuinfo',
32 'BMC Mem Info': 'cat /proc/meminfo',
33 'BMC File System Disk Space Usage': 'df -hT',
34 },
35 'APPLICATION DATA':
36 {
37 'BMC state': '/usr/sbin/obmcutil state',
38 },
39}
George Keishing4346a412016-07-19 11:26:49 -050040
George Keishing69e6f712016-09-12 06:30:09 -050041# Add file name and correcponding command needed for BMC
42FFDC_BMC_FILE = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050043 'BMC FILES':
44 {
45 # File Name Command
46 'BMC_proc_list': 'top -n 1 -b',
47 'BMC_journalctl.log': 'journalctl --no-pager',
48 'BMC_dmesg': 'dmesg',
49 },
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',
61 },
62}
63
Gunnar Millscce185d2016-10-17 17:04:15 -050064# Add file name and correcponding command needed for Ubuntu Linux
65FFDC_OS_UBUNTU_FILE = {
66 'OS FILES':
67 {
68 # File Name Command
69 'OS_isusb': 'lsusb -t ; lsusb -v',
70 'OS_kern': 'tail -n 50000 /var/log/kern.log',
71 'OS_authlog': 'cat /var/log/auth.log; cat /var/log/auth.log.1',
72 'OS_syslog': 'tail -n 200000 /var/log/syslog',
73 'OS_info': 'uname -a; dpkg -s opal-prd; dpkg -s ipmitool',
74 },
75}
76
77# Add file name and correcponding command needed for RHEL Linux
78FFDC_OS_RHEL_FILE = {
79 'OS FILES':
80 {
81 # File Name Command
82 'OS_rsct': '/usr/bin/ctversion -bv',
83 'OS_secure': 'cat /var/log/secure',
84 'OS_syslog': 'tail -n 200000 /var/log/messages',
85 'OS_info': 'lsb_release -a; cat /etc/redhat-release; uname -a; rpm -qa',
86 },
87}
88
89# Add file name and correcponding command needed for RHEL Linux
90FFDC_OS_IBM_POWERKVM_FILE = {
91 'OS FILES':
92 {
93 # File Name Command
94 'OS_secure': 'cat /var/log/secure',
95 'OS_syslog': 'tail -n 200000 /var/log/messages',
96 'OS_info': 'lsb_release -a; uname -a; rpm -qa',
97 },
98}
99
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500100# Add file name and correcponding Get Request
101FFDC_GET_REQUEST = {
102 'GET REQUESTS':
103 {
104 # File Name Command
105 'BMC_sensor_list': '/org/openbmc/sensors/enumerate',
106 'BMC_inventory': '/org/openbmc/inventory/system/enumerate',
107 'BMC_led': '/org/openbmc/control/led/enumerate',
108 'BMC_record_log': '/org/openbmc/records/events/enumerate',
109 },
110}
111
George Keishing69e6f712016-09-12 06:30:09 -0500112
113# Define your keywords in method/utils and call here
114FFDC_METHOD_CALL = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500115 'BMC LOGS':
116 {
117 # Description Keyword name
118 'FFDC Generic Report': 'BMC FFDC Manifest',
119 'BMC Specific Files': 'BMC FFDC Files',
120 'Get Request FFDC': 'BMC FFDC Get Requests',
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500121 'OS FFDC': 'OS FFDC Files',
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500122 },
123}
George Keishing4346a412016-07-19 11:26:49 -0500124
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500125# -----------------------------------------------------------------
George Keishing4346a412016-07-19 11:26:49 -0500126
127
128# base class for FFDC default list
129class openbmc_ffdc_list():
130
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500131 def get_ffdc_bmc_cmd(self, i_type):
132 r"""
133 ########################################################################
134 # @brief This method returns the list from the dictionary for cmds
135 # @param i_type: @type string: string index lookup
136 # @return List of key pair from the dictionary
137 ########################################################################
138 """
George Keishing69e6f712016-09-12 06:30:09 -0500139 return FFDC_BMC_CMD[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500140
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500141 def get_ffdc_bmc_file(self, i_type):
142 r"""
143 ########################################################################
144 # @brief This method returns the list from the dictionary for scp
145 # @param i_type: @type string: string index lookup
146 # @return List of key pair from the dictionary
147 ########################################################################
148 """
George Keishing69e6f712016-09-12 06:30:09 -0500149 return FFDC_BMC_FILE[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500150
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500151 def get_ffdc_get_request(self, i_type):
152 r"""
153 ########################################################################
154 # @brief This method returns the list from the dictionary for scp
155 # @param i_type: @type string: string index lookup
156 # @return List of key pair from the dictionary
157 ########################################################################
158 """
159 return FFDC_GET_REQUEST[i_type].items()
160
George Keishing69e6f712016-09-12 06:30:09 -0500161 def get_ffdc_cmd_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500162 r"""
163 ########################################################################
164 # @brief This method returns the list index from dictionary
165 # @return List of index to the dictionary
166 ########################################################################
167 """
George Keishing69e6f712016-09-12 06:30:09 -0500168 return FFDC_BMC_CMD.keys()
169
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500170 def get_ffdc_get_request_index(self):
171 r"""
172 ########################################################################
173 # @brief This method returns the list index from dictionary
174 # @return List of index to the dictionary
175 ########################################################################
176 """
177 return FFDC_GET_REQUEST.keys()
178
George Keishing69e6f712016-09-12 06:30:09 -0500179 def get_ffdc_file_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500180 r"""
181 ########################################################################
182 # @brief This method returns the list index from dictionary
183 # @return List of index to the dictionary
184 ########################################################################
185 """
George Keishing69e6f712016-09-12 06:30:09 -0500186 return FFDC_BMC_FILE.keys()
187
George Keishing69e6f712016-09-12 06:30:09 -0500188 def get_ffdc_method_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500189 r"""
190 ########################################################################
191 # @brief This method returns the key pair from the dictionary
192 # @return Index of the method dictionary
193 ########################################################################
194 """
George Keishing69e6f712016-09-12 06:30:09 -0500195 return FFDC_METHOD_CALL.keys()
196
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500197 def get_ffdc_method_call(self, i_type):
198 r"""
199 ########################################################################
200 # @brief This method returns the key pair from the dictionary
201 # @return List of key pair keywords
202 ########################################################################
203 """
George Keishing69e6f712016-09-12 06:30:09 -0500204 return FFDC_METHOD_CALL[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500205
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500206 def get_ffdc_os_all_distros_index(self):
207 r"""
208 ########################################################################
209 # @brief This method returns the key pair from the dictionary
210 # @return Index of the method dictionary
211 ########################################################################
212 """
213 return FFDC_OS_ALL_DISTROS_FILE.keys()
214
215 def get_ffdc_os_all_distros_call(self, i_type):
216 r"""
217 ########################################################################
218 # @brief This method returns the key pair from the dictionary
219 # @return List of key pair keywords
220 ########################################################################
221 """
222 return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
223
Gunnar Millscce185d2016-10-17 17:04:15 -0500224 def get_ffdc_os_distro_index(self, distro):
225 r"""
226 ########################################################################
227 # @brief This method returns the key pair from the dictionary
228 # @return Index of the method dictionary
229 ########################################################################
230 """
231 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
232 return eval(distro_file).keys()
233
234 def get_ffdc_os_distro_call(self, i_type, distro):
235 r"""
236 ########################################################################
237 # @brief This method returns the key pair from the dictionary
238 # @return List of key pair keywords
239 ########################################################################
240 """
241 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
242 return eval(distro_file)[i_type].items()
243
George Keishing4346a412016-07-19 11:26:49 -0500244 def get_strip_string(self, i_str):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500245 r"""
246 ########################################################################
247 # @brief Returns the stripped strings
248 # @param i_str: @type string: string name
249 # @return Remove all special chars and return the string
250 ########################################################################
251 """
George Keishing4346a412016-07-19 11:26:49 -0500252 return ''.join(e for e in i_str if e.isalnum())