Inventory: Implementing the association of objects.
This script will look at the associated types in the config file
and make the association.
Change-Id: I25bafb1308bbcb1febc2c24d8154643a1f154cdb
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/Util.pm b/Util.pm
index aa98b56..c6245a4 100644
--- a/Util.pm
+++ b/Util.pm
@@ -61,6 +61,29 @@
return undef;
}
+#Returns the array of all the device paths based on the type.
+# param[in] \@inventory = reference to array of inventory items.
+# param[in] $targetObj = The Targets object.
+# param[in] $type = The target type.
+sub getDevicePath
+{
+ my ($inventory_ref, $targetObj, $type) = @_;
+ my @inventory = @{ $inventory_ref };
+ my $fruType = "";
+ my @devices;
+ for my $item (@inventory)
+ {
+ if (!$targetObj->isBadAttribute($item->{TARGET}, "TYPE")) {
+ $fruType = $targetObj->getAttribute($item->{TARGET}, "TYPE");
+ if ($fruType eq $type) {
+ push(@devices,$item->{OBMC_NAME});
+ }
+ }
+ }
+ return @devices;
+}
+
+
1;
=head1 NAME
@@ -90,6 +113,9 @@
Returns an OBMC name corresponding to a Target name. Returns
undef if the Target name is not found.
+=item getDevicePath(C<InventoryItems>, C<TargetsObj>, C<TargetType>)
+#Returns the array of all the device path based on the C<TargetType>.
+
=back
=cut