blob: cf2eeab60a9582ebe207d97b6bbaa85483221f64 [file] [log] [blame]
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -06001#!/usr/bin/env python
2
3r"""
4PEL functions.
5"""
6
7import func_args as fa
8import bmc_ssh_utils as bsu
9import json
10
11
12def peltool(option_string, **bsu_options):
13 r"""
14 Run peltool on the BMC with the caller's option string and return the result.
15
16 Example:
17
18 ${pel_results}= Peltool -l
19 Rprint Vars pel_results
20
21 pel_results:
22 [0x50000031]:
23 [CompID]: 0x1000
24 [PLID]: 0x50000031
25 [Subsystem]: BMC Firmware
26 [Message]: An application had an internal failure
27 [SRC]: BD8D1002
28 [Commit Time]: 02/25/2020 04:51:31
29 [Sev]: Unrecoverable Error
30 [CreatorID]: BMC
31
32 Description of argument(s):
33 option_string A string of options which are to be processed by the peltool command.
34 bsu_options Options to be passed directly to bmc_execute_command. See its prolog for
35 details.
36 """
37
38 bsu_options = fa.args_to_objects(bsu_options)
39 out_buf, stderr, rc = bsu.bmc_execute_command('peltool ' + option_string, **bsu_options)
40 out_buf = json.loads(out_buf)
41 return out_buf