blob: f71309ad786a648feecb0855c32658fd3ea22d76 [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 Millsa812e0f2016-09-29 20:30:03 -050064# Add file name and correcponding Get Request
65FFDC_GET_REQUEST = {
66 'GET REQUESTS':
67 {
68 # File Name Command
69 'BMC_sensor_list': '/org/openbmc/sensors/enumerate',
70 'BMC_inventory': '/org/openbmc/inventory/system/enumerate',
71 'BMC_led': '/org/openbmc/control/led/enumerate',
72 'BMC_record_log': '/org/openbmc/records/events/enumerate',
73 },
74}
75
George Keishing69e6f712016-09-12 06:30:09 -050076
77# Define your keywords in method/utils and call here
78FFDC_METHOD_CALL = {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050079 'BMC LOGS':
80 {
81 # Description Keyword name
82 'FFDC Generic Report': 'BMC FFDC Manifest',
83 'BMC Specific Files': 'BMC FFDC Files',
84 'Get Request FFDC': 'BMC FFDC Get Requests',
Gunnar Mills7e2cda22016-10-11 15:37:34 -050085 'OS FFDC': 'OS FFDC Files',
Gunnar Millsa812e0f2016-09-29 20:30:03 -050086 },
87}
George Keishing4346a412016-07-19 11:26:49 -050088
Gunnar Millsa812e0f2016-09-29 20:30:03 -050089# -----------------------------------------------------------------
George Keishing4346a412016-07-19 11:26:49 -050090
91
92# base class for FFDC default list
93class openbmc_ffdc_list():
94
Gunnar Millsa812e0f2016-09-29 20:30:03 -050095 def get_ffdc_bmc_cmd(self, i_type):
96 r"""
97 ########################################################################
98 # @brief This method returns the list from the dictionary for cmds
99 # @param i_type: @type string: string index lookup
100 # @return List of key pair from the dictionary
101 ########################################################################
102 """
George Keishing69e6f712016-09-12 06:30:09 -0500103 return FFDC_BMC_CMD[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500104
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500105 def get_ffdc_bmc_file(self, i_type):
106 r"""
107 ########################################################################
108 # @brief This method returns the list from the dictionary for scp
109 # @param i_type: @type string: string index lookup
110 # @return List of key pair from the dictionary
111 ########################################################################
112 """
George Keishing69e6f712016-09-12 06:30:09 -0500113 return FFDC_BMC_FILE[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500114
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500115 def get_ffdc_get_request(self, i_type):
116 r"""
117 ########################################################################
118 # @brief This method returns the list from the dictionary for scp
119 # @param i_type: @type string: string index lookup
120 # @return List of key pair from the dictionary
121 ########################################################################
122 """
123 return FFDC_GET_REQUEST[i_type].items()
124
George Keishing69e6f712016-09-12 06:30:09 -0500125 def get_ffdc_cmd_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500126 r"""
127 ########################################################################
128 # @brief This method returns the list index from dictionary
129 # @return List of index to the dictionary
130 ########################################################################
131 """
George Keishing69e6f712016-09-12 06:30:09 -0500132 return FFDC_BMC_CMD.keys()
133
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500134 def get_ffdc_get_request_index(self):
135 r"""
136 ########################################################################
137 # @brief This method returns the list index from dictionary
138 # @return List of index to the dictionary
139 ########################################################################
140 """
141 return FFDC_GET_REQUEST.keys()
142
George Keishing69e6f712016-09-12 06:30:09 -0500143 def get_ffdc_file_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500144 r"""
145 ########################################################################
146 # @brief This method returns the list index from dictionary
147 # @return List of index to the dictionary
148 ########################################################################
149 """
George Keishing69e6f712016-09-12 06:30:09 -0500150 return FFDC_BMC_FILE.keys()
151
George Keishing69e6f712016-09-12 06:30:09 -0500152 def get_ffdc_method_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500153 r"""
154 ########################################################################
155 # @brief This method returns the key pair from the dictionary
156 # @return Index of the method dictionary
157 ########################################################################
158 """
George Keishing69e6f712016-09-12 06:30:09 -0500159 return FFDC_METHOD_CALL.keys()
160
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500161 def get_ffdc_method_call(self, i_type):
162 r"""
163 ########################################################################
164 # @brief This method returns the key pair from the dictionary
165 # @return List of key pair keywords
166 ########################################################################
167 """
George Keishing69e6f712016-09-12 06:30:09 -0500168 return FFDC_METHOD_CALL[i_type].items()
George Keishing4346a412016-07-19 11:26:49 -0500169
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500170 def get_ffdc_os_all_distros_index(self):
171 r"""
172 ########################################################################
173 # @brief This method returns the key pair from the dictionary
174 # @return Index of the method dictionary
175 ########################################################################
176 """
177 return FFDC_OS_ALL_DISTROS_FILE.keys()
178
179 def get_ffdc_os_all_distros_call(self, i_type):
180 r"""
181 ########################################################################
182 # @brief This method returns the key pair from the dictionary
183 # @return List of key pair keywords
184 ########################################################################
185 """
186 return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
187
George Keishing4346a412016-07-19 11:26:49 -0500188 def get_strip_string(self, i_str):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500189 r"""
190 ########################################################################
191 # @brief Returns the stripped strings
192 # @param i_str: @type string: string name
193 # @return Remove all special chars and return the string
194 ########################################################################
195 """
George Keishing4346a412016-07-19 11:26:49 -0500196 return ''.join(e for e in i_str if e.isalnum())