blob: 5092a588e81fff1742dd121df8e8dc6729054664 [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 ),
George Keishingecf44282024-05-20 20:44:17 +053072 "vpd-inventory.txt": "vpd-tool -i >/tmp/vpd-inventory.txt 2>&1",
Patrick Williams20f38712022-12-08 06:18:26 -060073 "PEL_logs_list.json": "peltool -l >/tmp/PEL_logs_list.json 2>&1",
74 "PEL_logs_complete_list.json": (
75 "peltool -l -a -f >/tmp/PEL_logs_complete_list.json 2>&1"
76 ),
77 "PEL_logs_display.json": "peltool -a >/tmp/PEL_logs_display.json 2>&1",
78 "PEL_logs_complete_display.json": (
79 "peltool -a -f -h>/tmp/PEL_logs_complete_display.json 2>&1"
80 ),
George Keishing4afd6552023-02-06 03:08:04 -060081 "PEL_logs_badPEL.txt": (
82 "hexdump -C"
83 + " /var/lib/phosphor-logging/extensions/pels/badPEL>/tmp/PEL_logs_badPEL.txt"
84 " 2>&1"
85 ),
Patrick Williams20f38712022-12-08 06:18:26 -060086 "PLDM_fru_record.txt": (
87 "pldmtool fru getfrurecordtable>/tmp/PLDM_fru_record.txt 2>&1"
88 ),
89 "BMC_pldm_flight_recorder.txt": (
90 "rm -rf /tmp/pldm_flight_recorder; killall -s SIGUSR1 pldmd;"
George Keishing4afd6552023-02-06 03:08:04 -060091 + " sleep 5; cat /tmp/pldm_flight_recorder >"
92 " /tmp/BMC_pldm_flight_recorder.txt 2>&1;"
93 ),
94 "OCC_state.txt": (
95 'echo "OCC state check";for i in {0..3};'
96 + " do (echo /org/open_power/control/occ$i;"
97 + " busctl get-property org.open_power.OCC.Control"
98 " /org/open_power/control/occ$i"
99 + " org.open_power.OCC.Status OccActive) done > /tmp/OCC_state.txt"
100 " 2>&1"
101 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600102 "bmcweb_persistent_data.json": (
103 "cat /home/root/bmcweb_persistent_data.json"
George Keishing4afd6552023-02-06 03:08:04 -0600104 + " > /tmp/bmcweb_persistent_data.json"
105 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600106 "GUARD_list.txt": "guard -l > /tmp/GUARD_list.txt 2>&1",
107 "fan_control_dump.json": "fanctl dump; sleep 5",
George Keishing326e41b2023-12-13 14:52:45 +0530108 "fan_monitor_dump.json": "killall -s SIGUSR1 phosphor-fan-monitor; sleep 5",
Patrick Williams20f38712022-12-08 06:18:26 -0600109 "DEVTREE": (
110 "cat /var/lib/phosphor-software-manager/pnor/rw/DEVTREE >"
111 " /tmp/DEVTREE 2>&1"
112 ),
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500113 },
114}
George Keishingf9f661d2020-03-18 11:42:53 -0500115# Add file name and corresponding command needed for all Linux distributions
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500116FFDC_OS_ALL_DISTROS_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600117 "OS FILES": {
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500118 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600119 "OS_msglog.txt": (
120 "cat /sys/firmware/opal/msglog >/tmp/OS_msglog.txt 2>&1"
121 ),
George Keishing4afd6552023-02-06 03:08:04 -0600122 "OS_cpufrequency.txt": (
123 "ppc64_cpu --frequency >/tmp/OS_cpufrequency.txt 2>&1"
124 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600125 "OS_dmesg.txt": "dmesg >/tmp/OS_dmesg.txt 2>&1",
126 "OS_opal_prd.txt": "cat /var/log/opal-prd* >/tmp/OS_opal_prd.txt 2>&1",
127 "OS_boot.txt": "cat /var/log/boot.log >/tmp/OS_boot.txt 2>&1",
128 "OS_procinfo.txt": "cat /proc/cpuinfo >/tmp/OS_procinfo.txt 2>&1",
129 "OS_meminfo.txt": "cat /proc/meminfo >/tmp/OS_meminfo.txt 2>&1",
130 "OS_netstat.txt": "netstat -a >/tmp/OS_netstat.txt 2>&1",
131 "OS_lspci.txt": "lspci >/tmp/OS_lspci.txt 2>&1",
132 "OS_lscpu.txt": "lscpu >/tmp/OS_lscpu.txt 2>&1",
133 "OS_lscfg.txt": "lscfg >/tmp/OS_lscfg.txt 2>&1",
George Keishing4afd6552023-02-06 03:08:04 -0600134 "OS_journalctl_nopager.txt": (
135 "journalctl --no-pager -b "
136 + "> /tmp/OS_journalctl_nopager.txt 2>&1"
137 ),
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500138 },
139}
George Keishing671dd662021-05-28 03:26:30 -0500140# Add file name and corresponding command needed for Ubuntu Linux
Gunnar Millscce185d2016-10-17 17:04:15 -0500141FFDC_OS_UBUNTU_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600142 "OS FILES": {
Gunnar Millscce185d2016-10-17 17:04:15 -0500143 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600144 "OS_isusb.txt": "{ lsusb -t ; lsusb -v ; } >/tmp/OS_isusb.txt 2>&1",
145 "OS_kern.txt": (
146 "tail -n 50000 /var/log/kern.log >/tmp/OS_kern.txt 2>&1"
147 ),
148 "OS_authlog.txt": (
149 "{ cat /var/log/auth.log; cat /var/log/auth.log.1 ; } "
George Keishing4afd6552023-02-06 03:08:04 -0600150 + ">/tmp/OS_authlog.txt 2>&1"
151 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600152 "OS_syslog.txt": (
153 "tail -n 200000 /var/log/syslog >/tmp/OS_syslog.txt 2>&1"
154 ),
George Keishing4afd6552023-02-06 03:08:04 -0600155 "OS_info.txt": (
156 "{ uname -a; dpkg -s opal-prd; dpkg -s ipmitool ; } "
157 + ">/tmp/OS_info.txt 2>&1"
158 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600159 "OS_sosreport.txt": (
160 "{ rm -rf /tmp/sosreport*FFDC* ; sosreport --batch --tmp-dir "
George Keishing4afd6552023-02-06 03:08:04 -0600161 + "/tmp --ticket-number FFDC ; } >/tmp/OS_sosreport.txt 2>&1"
162 ),
Gunnar Millscce185d2016-10-17 17:04:15 -0500163 },
164}
George Keishing671dd662021-05-28 03:26:30 -0500165# Add file name and corresponding command needed for RHEL Linux
Gunnar Millscce185d2016-10-17 17:04:15 -0500166FFDC_OS_RHEL_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600167 "OS FILES": {
Gunnar Millscce185d2016-10-17 17:04:15 -0500168 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600169 "OS_rsct.txt": "/usr/bin/ctversion -bv >/tmp/OS_rsct.txt 2>&1",
170 "OS_secure.txt": "cat /var/log/secure >/tmp/OS_secure.txt 2>&1",
George Keishing4afd6552023-02-06 03:08:04 -0600171 "OS_syslog.txt": (
172 "tail -n 200000 /var/log/messages >/tmp/OS_syslog.txt 2>&1"
173 ),
174 "OS_info.txt": (
175 "{ lsb_release -a; cat /etc/redhat-release; "
176 + "uname -a; rpm -qa ; } >/tmp/OS_info.txt 2>&1"
177 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600178 "OS_sosreport.txt": (
179 "{ rm -rf /tmp/sosreport*FFDC* ; sosreport --batch --tmp-dir "
George Keishing4afd6552023-02-06 03:08:04 -0600180 + "/tmp --label FFDC ; } >/tmp/OS_sosreport.txt 2>&1"
181 ),
Gunnar Millscce185d2016-10-17 17:04:15 -0500182 },
183}
George Keishing671dd662021-05-28 03:26:30 -0500184# Add file name and corresponding command needed for AIX.
185FFDC_OS_AIX_FILE = {
Patrick Williams20f38712022-12-08 06:18:26 -0600186 "OS FILES": {
George Keishing671dd662021-05-28 03:26:30 -0500187 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600188 "OS_errpt.txt": "errpt >/tmp/OS_errpt.txt 2>&1 ; errclear 0;",
189 "OS_processors.txt": "bindprocessor -q >/tmp/OS_processors.txt 2>&1",
George Keishing671dd662021-05-28 03:26:30 -0500190 },
191}
George Keishing19700762020-01-22 12:32:53 -0600192
George Keishinga5bbc302021-10-04 22:30:55 -0500193try:
Patrick Williams20f38712022-12-08 06:18:26 -0600194 redfish_support_trans_state = os.environ.get(
195 "REDFISH_SUPPORT_TRANS_STATE", 0
196 ) or int(
197 BuiltIn().get_variable_value(
198 "${REDFISH_SUPPORT_TRANS_STATE}", default=0
199 )
200 )
George Keishinga5bbc302021-10-04 22:30:55 -0500201except RobotNotRunningError:
202 pass
203
Patrick Williams20f38712022-12-08 06:18:26 -0600204OPENBMC_BASE = "/xyz/openbmc_project/"
205OPENPOWER_BASE = "/org/open_power/"
206ENUMERATE_SENSORS = OPENBMC_BASE + "sensors/enumerate"
207ENUMERATE_INVENTORY = OPENBMC_BASE + "inventory/enumerate"
208ENUMERATE_ELOG = OPENBMC_BASE + "logging/entry/enumerate"
209ENUMERATE_LED = OPENBMC_BASE + "led/enumerate"
210ENUMERATE_SW = OPENBMC_BASE + "software/enumerate"
211ENUMERATE_CONTROL = OPENBMC_BASE + "control/enumerate"
212ENUMERATE_STATE = OPENBMC_BASE + "state/enumerate"
213ENUMERATE_OCC = OPENPOWER_BASE + "/enumerate"
214ENUMERATE_DUMPS = OPENBMC_BASE + "dumps/enumerate"
215ENUMERATE_USER = OPENBMC_BASE + "user/enumerate"
Sweta Potthuria82efd62017-10-18 05:34:59 -0500216
George Keishing671dd662021-05-28 03:26:30 -0500217# Add file name and corresponding Get Request
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500218FFDC_GET_REQUEST = {
Patrick Williams20f38712022-12-08 06:18:26 -0600219 "GET REQUESTS": {
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500220 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600221 "FIRMWARE_list.txt": ENUMERATE_SW,
222 "BMC_sensor_list.txt": ENUMERATE_SENSORS,
223 "BMC_control_list.txt": ENUMERATE_CONTROL,
224 "BMC_inventory.txt": ENUMERATE_INVENTORY,
225 "BMC_elog.txt": ENUMERATE_ELOG,
226 "BMC_led.txt": ENUMERATE_LED,
227 "BMC_state.txt": ENUMERATE_STATE,
228 "OCC_state.txt": ENUMERATE_OCC,
229 "BMC_dumps.txt": ENUMERATE_DUMPS,
230 "BMC_USER.txt": ENUMERATE_USER,
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500231 },
232}
George Keishing8c42bbc2021-09-28 14:52:54 -0500233
George Keishinga5bbc302021-10-04 22:30:55 -0500234# Remove the REST dictionary elements.
235if redfish_support_trans_state == 1:
236 for key in list(FFDC_GET_REQUEST):
237 del FFDC_GET_REQUEST[key]
238
Patrick Williams20f38712022-12-08 06:18:26 -0600239REDFISH_BASE = "/redfish/v1/"
Patrick Williams20f38712022-12-08 06:18:26 -0600240REDFISH_FIRMWARE = REDFISH_BASE + "UpdateService/FirmwareInventory"
George Keishing8c42bbc2021-09-28 14:52:54 -0500241
Yi Huc32434a2024-01-11 17:33:10 -0800242try:
243 REDFISH_SYSTEM_ID = REDFISH_SYSTEM_ID = os.environ.get(
244 "SYSTEM_ID", ""
245 ) or BuiltIn().get_variable_value("${SYSTEM_ID}", default="system")
246
247 REDFISH_ELOG = (
248 REDFISH_BASE
249 + "Systems/"
250 + REDFISH_SYSTEM_ID
251 + "/LogServices/EventLog/Entries"
252 )
253except RobotNotRunningError:
254 REDFISH_ELOG = REDFISH_BASE + "Systems/system/LogServices/EventLog/Entries"
255 pass
256
George Keishing8c42bbc2021-09-28 14:52:54 -0500257# Add file name and corresponding Get Request
258FFDC_GET_REDFISH_REQUEST = {
Patrick Williams20f38712022-12-08 06:18:26 -0600259 "GET REQUESTS": {
George Keishing8c42bbc2021-09-28 14:52:54 -0500260 # File Name Command
Patrick Williams20f38712022-12-08 06:18:26 -0600261 "BMC_redfish_elog.txt": REDFISH_ELOG,
George Keishing8c42bbc2021-09-28 14:52:54 -0500262 },
263}
264
George Keishing69e6f712016-09-12 06:30:09 -0500265# Define your keywords in method/utils and call here
266FFDC_METHOD_CALL = {
Patrick Williams20f38712022-12-08 06:18:26 -0600267 "BMC LOGS": {
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500268 # Description Keyword name
Patrick Williams20f38712022-12-08 06:18:26 -0600269 "Start ffdc cleanup": "BMC FFDC Cleanup",
270 "FFDC Generic Report": "BMC FFDC Manifest",
271 "BMC Specific Files": "BMC FFDC Files",
272 "Get Request FFDC": "BMC FFDC Get Requests",
273 "Get Redfish Request FFDC": "BMC FFDC Get Redfish Requests",
274 "OS FFDC": "OS FFDC Files",
275 "Core Files": "SCP Coredump Files",
276 "SEL Log": "Collect eSEL Log",
277 "Sys Inventory Files": "System Inventory Files",
278 "Dump Files": "SCP Dump Files",
279 "PEL Files": "Collect PEL Log",
280 "Redfish Log": "Enumerate Redfish Resources",
George Keishing4afd6552023-02-06 03:08:04 -0600281 "Firmware Log": (
282 "Enumerate Redfish Resources "
283 + " enum_uri=/redfish/v1/UpdateService/FirmwareInventory "
284 + " file_enum_name=redfish_FIRMWARE_list.txt"
285 ),
Patrick Williams20f38712022-12-08 06:18:26 -0600286 "Redfish OEM Log": "Enumerate Redfish OEM Resources",
287 "End ffdc cleanup": "BMC FFDC Cleanup",
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500288 },
289}
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300290
George Keishing4b4eef72021-04-01 02:31:42 -0500291try:
Patrick Williams20f38712022-12-08 06:18:26 -0600292 platform_arch_type = os.environ.get(
293 "PLATFORM_ARCH_TYPE", ""
294 ) or BuiltIn().get_variable_value("${PLATFORM_ARCH_TYPE}", default="power")
George Keishing4b4eef72021-04-01 02:31:42 -0500295except RobotNotRunningError:
296 pass
297
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300298# Filter the logs based on platform type.
299if platform_arch_type == "x86":
Patrick Williams20f38712022-12-08 06:18:26 -0600300 del FFDC_BMC_FILE["BMC FILES"]["PEL_logs_list.json"]
301 del FFDC_BMC_FILE["BMC FILES"]["PEL_logs_display.json"]
302 del FFDC_METHOD_CALL["BMC LOGS"]["PEL Files"]
Konstantin Aladyshev67880492021-03-20 17:20:57 +0300303
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500304# -----------------------------------------------------------------
George Keishing4346a412016-07-19 11:26:49 -0500305# base class for FFDC default list
Gunnar Mills096cd562018-03-26 10:19:12 -0500306
307
Patrick Williams20f38712022-12-08 06:18:26 -0600308class openbmc_ffdc_list:
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500309 def get_ffdc_bmc_cmd(self, i_type):
310 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500311 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500312 # @brief This method returns the list from the dictionary for cmds
313 # @param i_type: @type string: string index lookup
314 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500315 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500316 """
George Keishing69e6f712016-09-12 06:30:09 -0500317 return FFDC_BMC_CMD[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500318
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500319 def get_ffdc_bmc_file(self, i_type):
320 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500321 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500322 # @brief This method returns the list from the dictionary for scp
323 # @param i_type: @type string: string index lookup
324 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500325 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500326 """
George Keishing69e6f712016-09-12 06:30:09 -0500327 return FFDC_BMC_FILE[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500328
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500329 def get_ffdc_get_request(self, i_type):
330 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500331 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500332 # @brief This method returns the list from the dictionary for scp
333 # @param i_type: @type string: string index lookup
334 # @return List of key pair from the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500335 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500336 """
337 return FFDC_GET_REQUEST[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500338
George Keishing8c42bbc2021-09-28 14:52:54 -0500339 def get_ffdc_get_redfish_request(self, i_type):
340 r"""
341 #######################################################################
342 # @brief This method returns the list from the dictionary for scp
343 # @param i_type: @type string: string index lookup
344 # @return List of key pair from the dictionary
345 #######################################################################
346 """
347 return FFDC_GET_REDFISH_REQUEST[i_type].items()
348
George Keishing69e6f712016-09-12 06:30:09 -0500349 def get_ffdc_cmd_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500350 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500351 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500352 # @brief This method returns the list index from dictionary
353 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500354 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500355 """
George Keishing69e6f712016-09-12 06:30:09 -0500356 return FFDC_BMC_CMD.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500357
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500358 def get_ffdc_get_request_index(self):
359 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500360 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500361 # @brief This method returns the list index from dictionary
362 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500363 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500364 """
365 return FFDC_GET_REQUEST.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500366
George Keishing8c42bbc2021-09-28 14:52:54 -0500367 def get_ffdc_get_redfish_request_index(self):
368 r"""
369 #######################################################################
370 # @brief This method returns the list index from dictionary
371 # @return List of index to the dictionary
372 #######################################################################
373 """
374 return FFDC_GET_REDFISH_REQUEST.keys()
375
George Keishing69e6f712016-09-12 06:30:09 -0500376 def get_ffdc_file_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500377 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500378 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500379 # @brief This method returns the list index from dictionary
380 # @return List of index to the dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500381 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500382 """
George Keishing69e6f712016-09-12 06:30:09 -0500383 return FFDC_BMC_FILE.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500384
George Keishing69e6f712016-09-12 06:30:09 -0500385 def get_ffdc_method_index(self):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500386 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500387 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500388 # @brief This method returns the key pair from the dictionary
389 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500390 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500391 """
George Keishing69e6f712016-09-12 06:30:09 -0500392 return FFDC_METHOD_CALL.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500393
Patrick Williams20f38712022-12-08 06:18:26 -0600394 def get_ffdc_method_desc(self, index):
Michael Walshe844e9a2017-04-20 16:51:10 -0500395 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500396 #######################################################################
Michael Walshe844e9a2017-04-20 16:51:10 -0500397 # @brief This method returns the just the keys from the dictionary.
398 # @return List of ffdc descriptions.
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500399 #######################################################################
Michael Walshe844e9a2017-04-20 16:51:10 -0500400 """
401 return FFDC_METHOD_CALL[index].keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500402
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500403 def get_ffdc_method_call(self, i_type):
404 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500405 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500406 # @brief This method returns the key pair from the dictionary
407 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500408 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500409 """
George Keishing69e6f712016-09-12 06:30:09 -0500410 return FFDC_METHOD_CALL[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500411
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500412 def get_ffdc_os_all_distros_index(self):
413 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500414 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500415 # @brief This method returns the key pair from the dictionary
416 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500417 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500418 """
419 return FFDC_OS_ALL_DISTROS_FILE.keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500420
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500421 def get_ffdc_os_all_distros_call(self, i_type):
422 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500423 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500424 # @brief This method returns the key pair from the dictionary
425 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500426 #######################################################################
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500427 """
428 return FFDC_OS_ALL_DISTROS_FILE[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500429
Gunnar Millscce185d2016-10-17 17:04:15 -0500430 def get_ffdc_os_distro_index(self, distro):
431 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500432 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500433 # @brief This method returns the key pair from the dictionary
434 # @return Index of the method dictionary
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500435 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500436 """
437 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
438 return eval(distro_file).keys()
Gunnar Mills096cd562018-03-26 10:19:12 -0500439
Gunnar Millscce185d2016-10-17 17:04:15 -0500440 def get_ffdc_os_distro_call(self, i_type, distro):
441 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500442 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500443 # @brief This method returns the key pair from the dictionary
444 # @return List of key pair keywords
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500445 #######################################################################
Gunnar Millscce185d2016-10-17 17:04:15 -0500446 """
447 distro_file = "FFDC_OS_" + str(distro).upper() + "_FILE"
448 return eval(distro_file)[i_type].items()
Gunnar Mills096cd562018-03-26 10:19:12 -0500449
George Keishing4346a412016-07-19 11:26:49 -0500450 def get_strip_string(self, i_str):
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500451 r"""
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500452 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500453 # @brief Returns the stripped strings
454 # @param i_str: @type string: string name
455 # @return Remove all special chars and return the string
Joy Onyerikwu004ad3c2018-06-11 16:29:56 -0500456 #######################################################################
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500457 """
Patrick Williams20f38712022-12-08 06:18:26 -0600458 return "".join(e for e in i_str if e.isalnum())
Gunnar Mills096cd562018-03-26 10:19:12 -0500459
George Keishing28da9482017-07-27 13:38:54 -0500460 def get_esel_index(self, esel_list):
461 r"""
462 #######################################################################
463 # @brief Returns the eSEL binary index.
464 # @param esel_ist: @type list: eSEL list.
465 # @return Index of "ESEL=" in the list.
466 #######################################################################
467 """
Patrick Williams20f38712022-12-08 06:18:26 -0600468 index = [i for i, str in enumerate(esel_list) if "ESEL=" in str]
George Keishing28da9482017-07-27 13:38:54 -0500469 return index[0]
Sweta Potthuria82efd62017-10-18 05:34:59 -0500470
471 def get_dump_index(self, dump_list):
472 r"""
473 #######################################################################
474 # @brief Returns the eSEL binary index.
475 # @param esel_ist: @type list: eSEL list.
476 # @return Index of "ESEL=" in the list.
477 #######################################################################
478 """
Patrick Williams20f38712022-12-08 06:18:26 -0600479 index = [i for i, str in enumerate(dump_list) if "DUMP=" in str]
Sweta Potthuria82efd62017-10-18 05:34:59 -0500480 return index[0]