GithubHelp home page GithubHelp logo

microtca-tech-lab / frugy Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 4.0 187 KB

FRU Generator YAML

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
microtca ipmi picmg fmc amc rtm fru fru-generator

frugy's Introduction

frugy - FRU Generator YAML

This is a tool which generates EEPROM images according to the IPMI FRU standard from YAML configuration files. It can also parse a FRU EEPROM image and write its contents to a YAML file, or dump them to stdout.

Installation

From PyPI:

pip3 install frugy

From GitHub:

pip3 install git+https://github.com/MicroTCA-Tech-Lab/frugy

Usage

$ frugy --help
usage: frugy [-h] [--version] [-o OUTPUT] [-w] [-r] [-d]
             [-e EEPROM_SIZE] [-s SET] [-t] [-b] [-c] [-l [LIST]]
             [-v VERBOSITY]
             [srcfile]

FRU Generator YAML

positional arguments:
  srcfile               Source file for reading

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -o OUTPUT, --output OUTPUT
                        output file (derived from input file if not set)
  -w, --write           FRU write mode (convert YAML to FRU image), default
  -r, --read            FRU read mode (convert FRU image to YAML)
  -d, --dump            dump FRU information to stdout (same as -r -o -)
  -e EEPROM_SIZE, --eeprom-size EEPROM_SIZE
                        pad FRU image to match EEPROM size in bytes (only
                        valid in write mode)
  -s SET, --set SET     set FRU record field to a value (only valid in write
                        mode)
  -t, --timestamp       set BoardInfo.mfg_date_time timestamp to current UTC
                        time (only valid in write mode)
  -b, --broken          enable workaround to parse Opal Kelly EEPROMs
  -c, --ignore-checksum-errors
                        ignore checksum errors when parsing a FRU image
  -l [LIST], --list [LIST]
                        list supported FRU records or schema of specified
                        record
  -v VERBOSITY, --verbosity VERBOSITY
                        set verbosity (0=quiet, 1=info, 2=debug)

Examples

frugy damc-fmc2zup.yml

Read damc-fmc2zup.yml configuration, generate FRU image damc-fmc2zup.bin.

frugy damc-fmc2zup.yml -o fmc2zup_fru_eeprom.bin -e 2048

Read damc-fmc2zup.yml configuration, generate fmc2zup_fru_eeprom.bin, make it 2048 bytes (pad with 0xff).

frugy damc-fmc2zup.bin -r

Read and parse FRU image damc-fmc2zup.bin, generate YAML file damc-fmc2zup.yml.

frugy dmmc-stamp.yml -s BoardInfo.serial_number=1234 -s ProductInfo.version=1.0 -t

Read dmmc-stamp.yml, generate FRU with BoardInfo.serial_number set to 1234, ProductInfo.version to 1.0 and BoardInfo.mfg_date_time to current UTC time.

frugy dmmc-stamp.yml -s serial_number=1234 -t

Read dmmc-stamp.yml, generate FRU with BoardInfo.serial_number and ProductInfo.serial_number set to 1234 and BoardInfo.mfg_date_time to current UTC time.

frugy -l

Show list of all supported FRU records.

frugy -l PointToPointConnectivity

Show layout of the FRU record called 'PointToPointConnectivity'.

Supported FRU records

YAML keywords for supported FRU records

Example configuration file

BoardInfo:
  manufacturer: DESY
  product_name: DMMC-STAMP Rev.A
  serial_number: '0000'
  part_number: '0000'
  fru_file_id: none
ProductInfo:
  manufacturer: DESY
  product_name: DMMC-STAMP Rev.A
  part_number: '0000'
  version: '0000'
  serial_number: '0000'
  asset_tag: none
  fru_file_id: none
MultirecordArea:
- type: ModuleCurrentRequirements
  current_draw: 6.5

More example configurations are stored in the examples folder.

frugy's People

Contributors

j-marjanovic avatar jan-atom avatar nbaking avatar paolosca27 avatar patrislav1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

frugy's Issues

StringField for all binary variants

Got some trouble with the reverse function and define StringFeld with binary data, like:

custom_info_fields:
  - "\x00\x77\xE4\x9F\xB4\x73"

I have adapted en/decode format in types.py and force StringFmt.BIN to get it working.

The Fru class constructor modifies initdict

I would like to initialize several Fru class instances from a common initialization dictionary (changing only the serial number in between). Unfortunately, after constructing the first Fru object, creating another one fails. Here is the minimal test case:

from frugy.fru import Fru

dict = {'MultirecordArea': [{'type': 'ModuleCurrentRequirements', 'current_draw': 4.0}]}

Fru(dict)
print("1st done")
Fru(dict)
print("2nd done")

After running it, I see "1st done" printed out, and then an exception is thrown before the second print.

Somehow the 'type' element gets removed from the initialization dictionary. I believe this was not an intended behavior.

Tested on version 0.4.0 installed by pip.

Best regards,
Aleksander from DMCS

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.