Git Product home page Git Product logo

openpower-pel-parsers's Introduction

Python PEL tools

PEL parser

The pel.peltool.peltool module parses PEL files and prints the resulting PEL fields in JSON. It will load and run the various component parsers if they are available.

Usage

The tool can parse a single PEL or a directory of PELs at once.

The following command writes the output to standard out.

$ python3 -m pel.peltool.peltool -f <PEL file>

The following commands parse every PEL in the directory passed in and write the output to <output directory>/<original filename>.<PEL EID>.json. It will skip files that aren't PELs.

$ python3 -m pel.peltool.peltool -d <directory> -o <output directory>
$ python3 -m pel.peltool.peltool -d <directory> -o <output directory> -e '.extracted'

If the -o option isn't specified, the files will be written to the same directory the PELs are in.

The -x option can be used to tell peltool to delete the original file after it is parsed.

The -e option can be used to only look at files with a specific extension.

The -p option can be used to skip loading any plugin modules.

The -s option can be used to only parse PELs if they are for serviceable errors, while the -n option will only parse PELs for non-serviceable ones.

SRC and user data parsers for OpenPOWER PELs

The parsers are made up of python modules which are packaged together with setuptools via the setup.py script. The modules are kept in a subdirectory in order to separate them from potential other tools that may be needed to build the packages.

For a reference on the requirements of these python modules see the OpenPOWER PEL README.md.

SRC parsers

Each subsystem requiring an SRC parser will create a single module in the format of:

modules/srcparsers/<subsystem>src/<subsystem>src.py

Where <subsystem> is a single character:

  • 'o' => BMC
  • 'b' => Hostboot

For example, the BMC subsystem would create:

modules/srcparsers/osrc/osrc.py

All SRC modules must define the parseSRCToJson function as shown in the OpenPOWER PEL README.md (see link above).

Important Note: Each SRC module will emcompass the parsing for all components of the target subsystem. This is unlike the user data parsers. Fortunately, as with all python, we can create submodules for each component if needed. So the parsing code does not need to be contained with the SRC module. Only the top level parseSRCToJson function is required.

Important Note: A wrapper has been created for the BMC subsystem SRC module. This wrapper mimics how the modules work for user data sections. See modules/srcparsers/osrc/osrc.py for details.

User data parsers

Each subsystem requiring user data parsers will create a module for each component in the format of:

modules/udparsers/<subsystem><component>/<subsystem><component>.py

Where <subsystem> is a single character:

  • 'o' => BMC
  • 'b' => Hostboot

And <component> is the four character component ID in the form xx00 (all lowercase).

For example, the PRD component in the Hostboot subsystem would create:

modules/udparsers/be500/be500.py

All user data modules must define the parseUDToJson function as shown in the OpenPOWER PEL README.md (see link above).

Testing

It is highly encouraged to build and maintain automated test cases using the standard unittest module. All test modules should be stored in the test/ directory (or subdirectory). Remember that all of the test files must be modules or packages importable from the top-level test/ directory, meaning all subdirectories must contain an __init__.py and the file names must be valid identifiers.

To run all test cases in test/, issue the following commands:

cd modules/
python3 -m unittest discover -v -s '../test/'

Reminder: It is important that the above unittest command is run in the modules subdirectory. This ensures that modules is in the import path.

peltool wrapper module

There is a setup.py in the peltool-wrapper directory that is used to build a peltool-wrapper python module that only contains dependencies to the component modules that make up peltool. Installing this module will then bring in and install all peltool modules assuming they are available in pip's search path.

openpower-pel-parsers's People

Contributors

spinler avatar zane131 avatar smccarney avatar cnpalmer avatar debmc avatar lxwinspur avatar devenrao avatar priyangaramasamy avatar rfrandse avatar harsh-agarwal1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.