blob: cd7dd3f60520bda6f7d28705ffafa029e08c9052 [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Gunnar Millsa812e0f2016-09-29 20:30:03 -05002r"""
George Keishing4346a412016-07-19 11:26:49 -05003# @file openbmc_ffdc_list.py
George Keishing4346a412016-07-19 11:26:49 -05004# @brief List for FFDC ( First failure data capture )
5# commands and files to be collected as a part
6# of the test case failure.
Gunnar Millsa812e0f2016-09-29 20:30:03 -05007"""
Konstantin Aladyshevc056c2b2021-03-25 11:59:39 +03008import os
9
Konstantin Aladyshev67880492021-03-20 17:20:57 +030010from robot.libraries.BuiltIn import BuiltIn
11
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# -------------------
Gunnar Millsa812e0f2016-09-29 20:30:03 -050015# -----------------------------------------------------------------
Gunnar Mills28e403b2017-10-25 16:16:38 -050016# Dict Name { Index string : { Key String : Command string} }
Gunnar Millsa812e0f2016-09-29 20:30:03 -050017# -----------------------------------------------------------------
George Keishing69e6f712016-09-12 06:30:09 -050018# Add cmd's needed to be part of the ffdc report manifest file
19FFDC_BMC_CMD = {
Patrick Williams20f38712022-12-08 06:18:26 -060020 "DRIVER INFO": {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050021 # String Name Command
Patrick Williams20f38712022-12-08 06:18:26 -060022 "FW Level": "cat /etc/os-release",
23 "FW Timestamp": "cat /etc/timestamp",
Gunnar Millsa812e0f2016-09-29 20:30:03 -050024 },
Patrick Williams20f38712022-12-08 06:18:26 -060025 "BMC DATA": {
26 "BMC OS": "uname -a",
27 "BMC Uptime": "uptime;cat /proc/uptime",
28 "BMC File System Disk Space Usage": "df -hT",
29 "BMC Date Time": "date;/sbin/hwclock --show;/usr/bin/timedatectl",
Gunnar Millsa812e0f2016-09-29 20:30:03 -050030 },
Patrick Williams20f38712022-12-08 06:18:26 -060031 "APPLICATION DATA": {
32 "BMC state": "/usr/bin/obmcutil state",
Gunnar Millsa812e0f2016-09-29 20:30:03 -050033 },
34}
George Keishing671dd662021-05-28 03:26:30 -050035# Add file name and corresponding command needed for BMC
George Keishing69e6f712016-09-12 06:30:09 -050036FFDC_BMC_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -060037 "BMC FILES": {
Gunnar Millsa812e0f2016-09-29 20:30:03 -050038 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -060039 "BMC_flash_side.txt": (
40 "cat /sys/class/watchdog/watchdog1/bootstatus"
41 " >/tmp/BMC_flash_side.txt 2>&1"
42 ),
43 "BMC_hwmon.txt": (
44 "grep -r . /sys/class/hwmon/* >/tmp/BMC_hwmon.txt 2>&1"
45 ),
46 "BMC_proc_list.txt": "top -n 1 -b >/tmp/BMC_proc_list.txt 2>&1",
47 "BMC_proc_fd_active_list.txt": (
48 "ls -Al /proc/*/fd/ >/tmp/BMC_proc_fd_active_list.txt 2>&1"
49 ),
50 "BMC_journalctl_nopager.txt": (
51 "journalctl --no-pager >/tmp/BMC_journalctl_nopager.txt 2>&1"
52 ),
53 "BMC_journalctl_pretty.json": (
54 "journalctl -o json-pretty >/tmp/BMC_journalctl_pretty.json 2>&1"
55 ),
56 "BMC_dmesg.txt": "dmesg >/tmp/BMC_dmesg.txt 2>&1",
57 "BMC_procinfo.txt": "cat /proc/cpuinfo >/tmp/BMC_procinfo.txt 2>&1",
58 "BMC_meminfo.txt": "cat /proc/meminfo >/tmp/BMC_meminfo.txt 2>&1",
59 "BMC_systemd.txt": "systemctl status --all >/tmp/BMC_systemd.txt 2>&1",
60 "BMC_failed_service.txt": (
61 "systemctl list-units --failed >/tmp/BMC_failed_service.txt 2>&1"
62 ),
63 "BMC_list_service.txt": (
64 "systemctl list-jobs >/tmp/BMC_list_service.txt 2>&1"
65 ),
66 "BMC_obmc_console.txt": (
67 "cat /var/log/obmc-console.log >/tmp/BMC_obmc_console.txt 2>&1"
68 ),
69 "BMC_obmc_console1.txt": (
70 "cat /var/log/obmc-console1.log >/tmp/BMC_obmc_console1.txt 2>&1"
71 ),
72 "PEL_logs_list.json": "peltool -l >/tmp/PEL_logs_list.json 2>&1",
73 "PEL_logs_complete_list.json": (
74 "peltool -l -a -f >/tmp/PEL_logs_complete_list.json 2>&1"
75 ),
76 "PEL_logs_display.json": "peltool -a >/tmp/PEL_logs_display.json 2>&1",
77 "PEL_logs_complete_display.json": (
78 "peltool -a -f -h>/tmp/PEL_logs_complete_display.json 2>&1"
79 ),
George Keishing4afd6552023-02-06 03:08:04 -060080 "PEL_logs_badPEL.txt": (
81 "hexdump -C"
82 + " /var/lib/phosphor-logging/extensions/pels/badPEL>/tmp/PEL_logs_badPEL.txt"
83 " 2>&1"
84 ),
Patrick Williams20f38712022-12-08 06:18:26 -060085 "PLDM_fru_record.txt": (
86 "pldmtool fru getfrurecordtable>/tmp/PLDM_fru_record.txt 2>&1"
87 ),
88 "BMC_pldm_flight_recorder.txt": (
89 "rm -rf /tmp/pldm_flight_recorder; killall -s SIGUSR1 pldmd;"
George Keishing4afd6552023-02-06 03:08:04 -060090 + " sleep 5; cat /tmp/pldm_flight_recorder >"
91 " /tmp/BMC_pldm_flight_recorder.txt 2>&1;"
92 ),
93 "OCC_state.txt": (
94 'echo "OCC state check";for i in {0..3};'
95 + " do (echo /org/open_power/control/occ$i;"
96 + " busctl get-property org.open_power.OCC.Control"
97 " /org/open_power/control/occ$i"
98 + " org.open_power.OCC.Status OccActive) done > /tmp/OCC_state.txt"
99 " 2>&1"
100 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600101 "bmcweb_persistent_data.json": (
102 "cat /home/root/bmcweb_persistent_data.json"
George Keishing4afd6552023-02-06 03:08:04 -0600103 + " > /tmp/bmcweb_persistent_data.json"
104 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600105 "GUARD_list.txt": "guard -l > /tmp/GUARD_list.txt 2>&1",
106 "fan_control_dump.json": "fanctl dump; sleep 5",
George Keishing326e41b2023-12-13 14:52:45 +0530107 "fan_monitor_dump.json": "killall -s SIGUSR1 phosphor-fan-monitor; sleep 5",
Patrick Williams20f38712022-12-08 06:18:26 -0600108 "DEVTREE": (
109 "cat /var/lib/phosphor-software-manager/pnor/rw/DEVTREE >"
110 " /tmp/DEVTREE 2>&1"
111 ),
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500112 },
113}
George Keishingf9f661d2020-03-18 11:42:53 -0500114# Add file name and corresponding command needed for all Linux distributions
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500115FFDC_OS_ALL_DISTROS_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600116 "OS FILES": {
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500117 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600118 "OS_msglog.txt": (
119 "cat /sys/firmware/opal/msglog >/tmp/OS_msglog.txt 2>&1"
120 ),
George Keishing4afd6552023-02-06 03:08:04 -0600121 "OS_cpufrequency.txt": (
122 "ppc64_cpu --frequency >/tmp/OS_cpufrequency.txt 2>&1"
123 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600124 "OS_dmesg.txt": "dmesg >/tmp/OS_dmesg.txt 2>&1",
125 "OS_opal_prd.txt": "cat /var/log/opal-prd* >/tmp/OS_opal_prd.txt 2>&1",
126 "OS_boot.txt": "cat /var/log/boot.log >/tmp/OS_boot.txt 2>&1",
127 "OS_procinfo.txt": "cat /proc/cpuinfo >/tmp/OS_procinfo.txt 2>&1",
128 "OS_meminfo.txt": "cat /proc/meminfo >/tmp/OS_meminfo.txt 2>&1",
129 "OS_netstat.txt": "netstat -a >/tmp/OS_netstat.txt 2>&1",
130 "OS_lspci.txt": "lspci >/tmp/OS_lspci.txt 2>&1",
131 "OS_lscpu.txt": "lscpu >/tmp/OS_lscpu.txt 2>&1",
132 "OS_lscfg.txt": "lscfg >/tmp/OS_lscfg.txt 2>&1",
George Keishing4afd6552023-02-06 03:08:04 -0600133 "OS_journalctl_nopager.txt": (
134 "journalctl --no-pager -b "
135 + "> /tmp/OS_journalctl_nopager.txt 2>&1"
136 ),
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500137 },
138}
George Keishing671dd662021-05-28 03:26:30 -0500139# Add file name and corresponding command needed for Ubuntu Linux
Gunnar Millscce185d2016-10-17 17:04:15 -0500140FFDC_OS_UBUNTU_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600141 "OS FILES": {
Gunnar Millscce185d2016-10-17 17:04:15 -0500142 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600143 "OS_isusb.txt": "{ lsusb -t ; lsusb -v ; } >/tmp/OS_isusb.txt 2>&1",
144 "OS_kern.txt": (
145 "tail -n 50000 /var/log/kern.log >/tmp/OS_kern.txt 2>&1"
146 ),
147 "OS_authlog.txt": (
148 "{ cat /var/log/auth.log; cat /var/log/auth.log.1 ; } "
George Keishing4afd6552023-02-06 03:08:04 -0600149 + ">/tmp/OS_authlog.txt 2>&1"
150 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600151 "OS_syslog.txt": (
152 "tail -n 200000 /var/log/syslog >/tmp/OS_syslog.txt 2>&1"
153 ),
George Keishing4afd6552023-02-06 03:08:04 -0600154 "OS_info.txt": (
155 "{ uname -a; dpkg -s opal-prd; dpkg -s ipmitool ; } "
156 + ">/tmp/OS_info.txt 2>&1"
157 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600158 "OS_sosreport.txt": (
159 "{ rm -rf /tmp/sosreport*FFDC* ; sosreport --batch --tmp-dir "
George Keishing4afd6552023-02-06 03:08:04 -0600160 + "/tmp --ticket-number FFDC ; } >/tmp/OS_sosreport.txt 2>&1"
161 ),
Gunnar Millscce185d2016-10-17 17:04:15 -0500162 },
163}
George Keishing671dd662021-05-28 03:26:30 -0500164# Add file name and corresponding command needed for RHEL Linux
Gunnar Millscce185d2016-10-17 17:04:15 -0500165FFDC_OS_RHEL_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600166 "OS FILES": {
Gunnar Millscce185d2016-10-17 17:04:15 -0500167 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600168 "OS_rsct.txt": "/usr/bin/ctversion -bv >/tmp/OS_rsct.txt 2>&1",
169 "OS_secure.txt": "cat /var/log/secure >/tmp/OS_secure.txt 2>&1",
George Keishing4afd6552023-02-06 03:08:04 -0600170 "OS_syslog.txt": (
171 "tail -n 200000 /var/log/messages >/tmp/OS_syslog.txt 2>&1"
172 ),
173 "OS_info.txt": (
174 "{ lsb_release -a; cat /etc/redhat-release; "
175 + "uname -a; rpm -qa ; } >/tmp/OS_info.txt 2>&1"
176 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600177 "OS_sosreport.txt": (
178 "{ rm -rf /tmp/sosreport*FFDC* ; sosreport --batch --tmp-dir "
George Keishing4afd6552023-02-06 03:08:04 -0600179 + "/tmp --label FFDC ; } >/tmp/OS_sosreport.txt 2>&1"
180 ),
Gunnar Millscce185d2016-10-17 17:04:15 -0500181 },
182}
George Keishing671dd662021-05-28 03:26:30 -0500183# Add file name and corresponding command needed for AIX.
184FFDC_OS_AIX_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600185 "OS FILES": {
George Keishing671dd662021-05-28 03:26:30 -0500186 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600187 "OS_errpt.txt": "errpt >/tmp/OS_errpt.txt 2>&1 ; errclear 0;",
188 "OS_processors.txt": "bindprocessor -q >/tmp/OS_processors.txt 2>&1",
George Keishing671dd662021-05-28 03:26:30 -0500189 },
190}
George Keishing19700762020-01-22 12:32:53 -0600191
George Keishinga5bbc302021-10-04 22:30:55 -0500192try:
Patrick Williams20f38712022-12-08 06:18:26 -0600193 redfish_support_trans_state = os.environ.get(
194 "REDFISH_SUPPORT_TRANS_STATE", 0
195 ) or int(
196 BuiltIn().get_variable_value(
197 "${REDFISH_SUPPORT_TRANS_STATE}", default=0
198 )
199 )
George Keishinga5bbc302021-10-04 22:30:55 -0500200except RobotNotRunningError:
201 pass
202
Patrick Williams20f38712022-12-08 06:18:26 -0600203OPENBMC_BASE = "/xyz/openbmc_project/"
204OPENPOWER_BASE = "/org/open_power/"
205ENUMERATE_SENSORS = OPENBMC_BASE + "sensors/enumerate"
206ENUMERATE_INVENTORY = OPENBMC_BASE + "inventory/enumerate"
207ENUMERATE_ELOG = OPENBMC_BASE + "logging/entry/enumerate"
208ENUMERATE_LED = OPENBMC_BASE + "led/enumerate"
209ENUMERATE_SW = OPENBMC_BASE + "software/enumerate"
210ENUMERATE_CONTROL = OPENBMC_BASE + "control/enumerate"
211ENUMERATE_STATE = OPENBMC_BASE + "state/enumerate"
212ENUMERATE_OCC = OPENPOWER_BASE + "/enumerate"
213ENUMERATE_DUMPS = OPENBMC_BASE + "dumps/enumerate"
214ENUMERATE_USER = OPENBMC_BASE + "user/enumerate"
Sweta Potthuria82efd62017-10-18 05:34:59 -0500215
George Keishing671dd662021-05-28 03:26:30 -0500216# Add file name and corresponding Get Request
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500217FFDC_GET_REQUEST = {
Patrick Williams20f38712022-12-08 06:18:26 -0600218 "GET REQUESTS": {
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500219 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600220 "FIRMWARE_list.txt": ENUMERATE_SW,
221 "BMC_sensor_list.txt": ENUMERATE_SENSORS,
222 "BMC_control_list.txt": ENUMERATE_CONTROL,
223 "BMC_inventory.txt": ENUMERATE_INVENTORY,
224 "BMC_elog.txt": ENUMERATE_ELOG,
225 "BMC_led.txt": ENUMERATE_LED,
226 "BMC_state.txt": ENUMERATE_STATE,
227 "OCC_state.txt": ENUMERATE_OCC,
228 "BMC_dumps.txt": ENUMERATE_DUMPS,
229 "BMC_USER.txt": ENUMERATE_USER,
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500230 },
231}
George Keishing8c42bbc2021-09-28 14:52:54 -0500232
George Keishinga5bbc302021-10-04 22:30:55 -0500233# Remove the REST dictionary elements.
234if redfish_support_trans_state == 1:
235 for key in list(FFDC_GET_REQUEST):
236 del FFDC_GET_REQUEST[key]
237
Patrick Williams20f38712022-12-08 06:18:26 -0600238REDFISH_BASE = "/redfish/v1/"
239REDFISH_ELOG = REDFISH_BASE + "Systems/system/LogServices/EventLog/Entries"
240REDFISH_FIRMWARE = REDFISH_BASE + "UpdateService/FirmwareInventory"
George Keishing8c42bbc2021-09-28 14:52:54 -0500241
242# Add file name and corresponding Get Request
243FFDC_GET_REDFISH_REQUEST = {
Patrick Williams20f38712022-12-08 06:18:26 -0600244 "GET REQUESTS": {
George Keishing8c42bbc2021-09-28 14:52:54 -0500245 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600246 "BMC_redfish_elog.txt": REDFISH_ELOG,
George Keishing8c42bbc2021-09-28 14:52:54 -0500247 },
248}
249
George Keishing69e6f712016-09-12 06:30:09 -0500250# Define your keywords in method/utils and call here
251FFDC_METHOD_CALL = {
Patrick Williams20f38712022-12-08 06:18:26 -0600252 "BMC LOGS": {
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500253 # Description Keyword name
Patrick Williams20f38712022-12-08 06:18:26 -0600254 "Start ffdc cleanup": "BMC FFDC Cleanup",
255 "FFDC Generic Report": "BMC FFDC Manifest",
256 "BMC Specific Files": "BMC FFDC Files",
257 "Get Request FFDC": "BMC FFDC Get Requests",
258 "Get Redfish Request FFDC": "BMC FFDC Get Redfish Requests",
259 "OS FFDC": "OS FFDC Files",
260 "Core Files": "SCP Coredump Files",
261 "SEL Log": "Collect eSEL Log",
262 "Sys Inventory Files": "System Inventory Files",
263 "Dump Files": "SCP Dump Files",
264 "PEL Files": "Collect PEL Log",
265 "Redfish Log": "Enumerate Redfish Resources",
George Keishing4afd6552023-02-06 03:08:04 -0600266 "Firmware Log": (
267 "Enumerate Redfish Resources "
268 + " enum_uri=/redfish/v1/UpdateService/FirmwareInventory "
269 + " file_enum_name=redfish_FIRMWARE_list.txt"
270 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600271 "Redfish OEM Log": "Enumerate Redfish OEM Resources",
272 "End ffdc cleanup": "BMC FFDC Cleanup",
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500273 },
274}
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300275
George Keishing4b4eef72021-04-01 02:31:42 -0500276try:
Patrick Williams20f38712022-12-08 06:18:26 -0600277 platform_arch_type = os.environ.get(
278 "PLATFORM_ARCH_TYPE", ""
279 ) or BuiltIn().get_variable_value("${PLATFORM_ARCH_TYPE}", default="power")
George Keishing4b4eef72021-04-01 02:31:42 -0500280except RobotNotRunningError:
281 pass
282
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300283# Filter the logs based on platform type.
284if platform_arch_type == "x86":
Patrick Williams20f38712022-12-08 06:18:26 -0600285 del FFDC_BMC_FILE["BMC FILES"]["PEL_logs_list.json"]
286 del FFDC_BMC_FILE["BMC FILES"]["PEL_logs_display.json"]
287 del FFDC_METHOD_CALL["BMC LOGS"]["PEL Files"]
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300288
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500289# -----------------------------------------------------------------
George Keishing4346a412016-07-19 11:26:49 -0500290# base class for FFDC default list
Gunnar Mills096cd562018-03-26 10:19:12 -0500291
292
Patrick Williams20f38712022-12-08 06:18:26 -0600293class openbmc_ffdc_list:
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500294 def get_ffdc_bmc_cmd(self, i_type):
295 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500296 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500297 # @brief This method returns the list from the dictionary for cmds
298 # @param i_type: @type string: string index lookup
299 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500300 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500301 """
George Keishing69e6f712016-09-12 06:30:09 -0500302 return FFDC_BMC_CMD[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500303
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500304 def get_ffdc_bmc_file(self, i_type):
305 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500306 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500307 # @brief This method returns the list from the dictionary for scp
308 # @param i_type: @type string: string index lookup
309 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500310 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500311 """
George Keishing69e6f712016-09-12 06:30:09 -0500312 return FFDC_BMC_FILE[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500313
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500314 def get_ffdc_get_request(self, i_type):
315 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500316 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500317 # @brief This method returns the list from the dictionary for scp
318 # @param i_type: @type string: string index lookup
319 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500320 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500321 """
322 return FFDC_GET_REQUEST[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500323
George Keishing8c42bbc2021-09-28 14:52:54 -0500324 def get_ffdc_get_redfish_request(self, i_type):
325 r"""
326 #######################################################################
327 # @brief This method returns the list from the dictionary for scp
328 # @param i_type: @type string: string index lookup
329 # @return List of key pair from the dictionary
330 #######################################################################
331 """
332 return FFDC_GET_REDFISH_REQUEST[i_type].items()
333
George Keishing69e6f712016-09-12 06:30:09 -0500334 def get_ffdc_cmd_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500335 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500336 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500337 # @brief This method returns the list index from dictionary
338 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500339 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500340 """
George Keishing69e6f712016-09-12 06:30:09 -0500341 return FFDC_BMC_CMD.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500342
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500343 def get_ffdc_get_request_index(self):
344 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500345 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500346 # @brief This method returns the list index from dictionary
347 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500348 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500349 """
350 return FFDC_GET_REQUEST.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500351
George Keishing8c42bbc2021-09-28 14:52:54 -0500352 def get_ffdc_get_redfish_request_index(self):
353 r"""
354 #######################################################################
355 # @brief This method returns the list index from dictionary
356 # @return List of index to the dictionary
357 #######################################################################
358 """
359 return FFDC_GET_REDFISH_REQUEST.keys()
360
George Keishing69e6f712016-09-12 06:30:09 -0500361 def get_ffdc_file_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500362 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500363 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500364 # @brief This method returns the list index from dictionary
365 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500366 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500367 """
George Keishing69e6f712016-09-12 06:30:09 -0500368 return FFDC_BMC_FILE.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500369
George Keishing69e6f712016-09-12 06:30:09 -0500370 def get_ffdc_method_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500371 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500372 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500373 # @brief This method returns the key pair from the dictionary
374 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500375 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500376 """
George Keishing69e6f712016-09-12 06:30:09 -0500377 return FFDC_METHOD_CALL.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500378
Patrick Williams20f38712022-12-08 06:18:26 -0600379 def get_ffdc_method_desc(self, index):
Michael Walshe844e9a2017-04-20 16:51:10 -0500380 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500381 #######################################################################
Michael Walshe844e9a2017-04-20 16:51:10 -0500382 # @brief This method returns the just the keys from the dictionary.
383 # @return List of ffdc descriptions.
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500384 #######################################################################
Michael Walshe844e9a2017-04-20 16:51:10 -0500385 """
386 return FFDC_METHOD_CALL[index].keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500387
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500388 def get_ffdc_method_call(self, i_type):
389 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500390 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500391 # @brief This method returns the key pair from the dictionary
392 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500393 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500394 """
George Keishing69e6f712016-09-12 06:30:09 -0500395 return FFDC_METHOD_CALL[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500396
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500397 def get_ffdc_os_all_distros_index(self):
398 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500399 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500400 # @brief This method returns the key pair from the dictionary
401 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500402 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500403 """
404 return FFDC_OS_ALL_DISTROS_FILE.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500405
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500406 def get_ffdc_os_all_distros_call(self, i_type):
407 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500408 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500409 # @brief This method returns the key pair from the dictionary
410 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500411 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500412 """
413 return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500414
Gunnar Millscce185d2016-10-17 17:04:15 -0500415 def get_ffdc_os_distro_index(self, distro):
416 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500417 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500418 # @brief This method returns the key pair from the dictionary
419 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500420 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500421 """
422 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
423 return eval(distro_file).keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500424
Gunnar Millscce185d2016-10-17 17:04:15 -0500425 def get_ffdc_os_distro_call(self, i_type, distro):
426 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500427 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500428 # @brief This method returns the key pair from the dictionary
429 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500430 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500431 """
432 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
433 return eval(distro_file)[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500434
George Keishing4346a412016-07-19 11:26:49 -0500435 def get_strip_string(self, i_str):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500436 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500437 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500438 # @brief Returns the stripped strings
439 # @param i_str: @type string: string name
440 # @return Remove all special chars and return the string
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500441 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500442 """
Patrick Williams20f38712022-12-08 06:18:26 -0600443 return "".join(e for e in i_str if e.isalnum())
Gunnar Mills096cd562018-03-26 10:19:12 -0500444
George Keishing28da9482017-07-27 13:38:54 -0500445 def get_esel_index(self, esel_list):
446 r"""
447 #######################################################################
448 # @brief Returns the eSEL binary index.
449 # @param esel_ist: @type list: eSEL list.
450 # @return Index of "ESEL=" in the list.
451 #######################################################################
452 """
Patrick Williams20f38712022-12-08 06:18:26 -0600453 index = [i for i, str in enumerate(esel_list) if "ESEL=" in str]
George Keishing28da9482017-07-27 13:38:54 -0500454 return index[0]
Sweta Potthuria82efd62017-10-18 05:34:59 -0500455
456 def get_dump_index(self, dump_list):
457 r"""
458 #######################################################################
459 # @brief Returns the eSEL binary index.
460 # @param esel_ist: @type list: eSEL list.
461 # @return Index of "ESEL=" in the list.
462 #######################################################################
463 """
Patrick Williams20f38712022-12-08 06:18:26 -0600464 index = [i for i, str in enumerate(dump_list) if "DUMP=" in str]
Sweta Potthuria82efd62017-10-18 05:34:59 -0500465 return index[0]