summaryrefslogtreecommitdiffstats
path: root/print_targets.pl
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-04-09 13:18:29 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-04-09 13:20:33 -0500
commitbbd66d2c42a0119e51a3b3b918be9f6f2207780e (patch)
tree8dead7cc89eb2b292272542365b42bcc46ea93e1 /print_targets.pl
parent716262fd664152c088f6330273909b36475767a8 (diff)
downloadphosphor-mrw-tools-bbd66d2c42a0119e51a3b3b918be9f6f2207780e.tar.gz
phosphor-mrw-tools-bbd66d2c42a0119e51a3b3b918be9f6f2207780e.zip
Add tool to dump out all targets and attributesHEADmaster
Prints out every target along with its attributes for debug. Looks like: -------------------------------------------------------------- Target /sys-0/node-0/motherboard-0/proc_socket-0/module-0/p9_proc_m/eq2/core9 MRW_TYPE: NA CHIPLET_ID: 0x29 CDM_DOMAIN: CPU PRIMARY_CAPABILITIES: reserved: 0 supportsFsiScom: 1 supportsInbandScom: 0 supportsXscom: 1 MODEL: HWAS_STATE_CHANGED_FLAG: 0x0 CLASS: UNIT HWAS_STATE_CHANGED_SUBSCRIPTION_MASK: 0x00000001 PHYS_PATH: FRU_NAME: CORE9 BUS_TYPE: NA FRU_ID: 1 TYPE: CORE RESOURCE_IS_CRITICAL: 0 DUMMY_RW: 5 CHIP_UNIT: 9 INSTANCE_PATH: instance:sys-0/node-0/motherboard-0/proc_socket-0/core DECONFIG_GARDABLE: 1 IPMI_INSTANCE: 9 IPMI_SENSORS: Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I65f79ca0e85adfe93f6ff5d9dc5da6948757e1e0
Diffstat (limited to 'print_targets.pl')
-rwxr-xr-xprint_targets.pl46
1 files changed, 46 insertions, 0 deletions
diff --git a/print_targets.pl b/print_targets.pl
new file mode 100755
index 0000000..918e022
--- /dev/null
+++ b/print_targets.pl
@@ -0,0 +1,46 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+use mrw::Targets;
+
+my $targetObj;
+my $serverwizFile = $ARGV[0];
+if ((not defined $serverwizFile) || (! -e $serverwizFile)) {
+ die "Usage: $0 [XML filename]\n";
+}
+
+$targetObj = Targets->new;
+$targetObj->loadXML($serverwizFile);
+
+dumpMRW($targetObj);
+
+sub dumpMRW
+{
+ my ($targetObj) = @_;
+
+ for my $target (sort keys %{$targetObj->getAllTargets()}) {
+ print "-----------------------------------------------------------\n";
+ print "Target $target\n";
+ my $thash = $targetObj->getTarget($target);
+
+ for my $attr (keys %{$thash->{ATTRIBUTES}}) {
+ print "\t$attr: ";
+
+ if (ref($thash->{ATTRIBUTES}->{$attr}->{default}) eq "HASH") {
+ print "\n";
+
+ for my $f (sort keys %{$thash->{ATTRIBUTES}->
+ {$attr}->{default}->{field}}) {
+
+ my $val = $thash->{ATTRIBUTES}->
+ {$attr}->{default}->{field}->{$f}->{value};
+ print "\t\t$f: $val\n";
+ }
+ }
+ else {
+ print $thash->{ATTRIBUTES}->{$attr}->{default} . "\n";
+ }
+ }
+ }
+}
OpenPOWER on IntegriCloud