Skip to content

debmc/openpower-pel-parsers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

$ python3 -m pel.peltool.peltool -f <PEL file>
$ python3 .../site-packages/pel/peltool/peltool.py -f <PEL file>

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 79.6%
  • C 20.4%