diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2017-09-25 15:49:16 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-10 13:54:32 +0000 |
commit | bff568414417de7e487b7722858cb7f7634546a3 (patch) | |
tree | 2fe1c1920fc4c253ee56f32f7dd00f8ad638850b | |
parent | a93e2097d17e4b8d0eae48c477c12a6f03278e75 (diff) | |
download | phosphor-mrw-tools-bff568414417de7e487b7722858cb7f7634546a3.tar.gz phosphor-mrw-tools-bff568414417de7e487b7722858cb7f7634546a3.zip |
Create gen_settings.pl
Created gen_settings.pl, to be used to get settings boundary and
default values like OPEN_POWER_N_PLUS_ONE_BULK_POWER_LIMIT_WATTS
from the MRW. Just the base commit for gen_settings.pl, more to
come.
Change-Id: Iea68db8e588c114fa600c0d3e87f4d763f783c01
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rwxr-xr-x[-rw-r--r--] | Build.PL | 1 | ||||
-rwxr-xr-x | gen_settings.pl | 56 |
2 files changed, 57 insertions, 0 deletions
@@ -15,6 +15,7 @@ Module::Build->new( 'gen_openpower_fru.pl', 'gen_presence_yaml.pl', 'gen_occ_map.pl', + 'gen_settings.pl', 'hwmon.pl'], pm_files => {'Inventory.pm' => 'lib/mrw/Inventory.pm', 'Util.pm' => 'lib/mrw/Util.pm'}, diff --git a/gen_settings.pl b/gen_settings.pl new file mode 100755 index 0000000..06794ff --- /dev/null +++ b/gen_settings.pl @@ -0,0 +1,56 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use mrw::Targets; # Set of APIs allowing access to parsed ServerWiz2 XML output +use Getopt::Long; # For parsing command line arguments + +# Globals +my $force = 0; +my $serverwizFile = ""; +my $debug = 0; +my $outputFile = ""; + +# Command line argument parsing +GetOptions( +"f" => \$force, # numeric +"i=s" => \$serverwizFile, # string +"o=s" => \$outputFile, # string +"d" => \$debug, +) +or printUsage(); + +if (($serverwizFile eq "") or ($outputFile eq "")) +{ + printUsage(); +} + +# API used to access parsed XML data +my $targetObj = Targets->new; +if($debug == 1) +{ + $targetObj->{debug} = 1; +} + +if($force == 1) +{ + $targetObj->{force} = 1; +} + +$targetObj->loadXML($serverwizFile); +print "Loaded MRW XML: $serverwizFile \n"; + +# Usage +sub printUsage +{ + print " + $0 -i [XML filename] -o [Output filename] [OPTIONS] +Options: + -f = force output file creation even when errors + -d = debug mode + +PS: mrw::Targets can be found in https://github.com/open-power/serverwiz/ + mrw::Inventory can be found in https://github.com/openbmc/phosphor-mrw-tools/ + \n"; + exit(1); +} |