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 <dkodihal@in.ibm.com>
diff --git a/gen_ipmi_fru.pl b/gen_ipmi_fru.pl
index 99884d9..5465d84 100755
--- a/gen_ipmi_fru.pl
+++ b/gen_ipmi_fru.pl
@@ -4,6 +4,7 @@
 
 use mrw::Targets;
 use mrw::Inventory;
+use mrw::Util;
 use Getopt::Long; # For parsing command line arguments
 use YAML::Tiny qw(LoadFile);
 
@@ -106,7 +107,7 @@
 
         printDebug("     ".$child);
         printDebug("     Type:".$fruType );
-        my $childObmcName = getObmcName(\@inventory, $child);
+        my $childObmcName = Util::getObmcName(\@inventory, $child);
         writeToFile($fruType, $childObmcName, $fruTypeConfig, $fh);
     }
 }
@@ -114,22 +115,6 @@
 
 #------------------------------------END OF MAIN-----------------------
 
-# Map an MRW name to corresponding OBMC name
-sub getObmcName
-{
-    my $inventory = $_[0]; # Inventory items
-    my $target = $_[1]; # MRW Target name
-    for my $item (@inventory)
-    {
-        if($item->{TARGET} eq $target)
-        {
-            return $item->{OBMC_NAME};
-        }
-    }
-    return undef;
-}
-
-
 #Get the metdata for the incoming frutype from the loaded config file.
 #Write the FRU data into the output file