From 6225e93d37644774aaecc30cb0161d0eaf0f570d Mon Sep 17 00:00:00 2001 From: Deepak Kodihalli Date: Tue, 7 Feb 2017 12:14:55 -0600 Subject: gen_openpower_fru.pl : Fetch inventory paths In preparation for the openpower-vpd-parser recipe, this script will, from an input openpower vpd-config YAML file, determine which inventory objects we're interested in, and will fetch from the MRW pathnames these objects should have. The script will output a file in a format that can serve as an environment file for a systemd service, which in turn will launch the openpower-vpd-parser application with this information. Change-Id: I7c4fa70af002f63bd5501093802c1d41bd503e88 Signed-off-by: Deepak Kodihalli --- Util.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Util.pm') diff --git a/Util.pm b/Util.pm index d85726a..aa98b56 100644 --- a/Util.pm +++ b/Util.pm @@ -43,6 +43,24 @@ sub getChildUnitsWithTargetType return @units; } +# Returns OBMC name corresponding to a Target name +# param[in] \@inventory = reference to array of inventory items +# param[in] $targetName = A Target name +sub getObmcName +{ + my ($inventory_ref, $targetName) = @_; + my @inventory = @{ $inventory_ref }; + + for my $item (@inventory) + { + if($item->{TARGET} eq $targetName) + { + return $item->{OBMC_NAME}; + } + } + return undef; +} + 1; =head1 NAME @@ -67,6 +85,11 @@ it will die. Currently supports single BMC systems. Returns an array of targets that have target-type C and are children (any level) of target C. +=item getObmcName(C, C) + +Returns an OBMC name corresponding to a Target name. Returns +undef if the Target name is not found. + =back =cut -- cgit v1.2.1