summaryrefslogtreecommitdiffstats
path: root/gen_settings.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gen_settings.pl')
-rwxr-xr-xgen_settings.pl56
1 files changed, 56 insertions, 0 deletions
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);
+}
OpenPOWER on IntegriCloud