From bff568414417de7e487b7722858cb7f7634546a3 Mon Sep 17 00:00:00 2001 From: Gunnar Mills Date: Mon, 25 Sep 2017 15:49:16 -0500 Subject: 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 --- gen_settings.pl | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 gen_settings.pl (limited to 'gen_settings.pl') 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); +} -- cgit v1.2.1