2009-12-02 09:41:06 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
2009-12-10 02:19:40 +00:00
|
|
|
package xCAT::FSPinv;
|
2009-12-02 09:41:06 +00:00
|
|
|
use strict;
|
|
|
|
use Getopt::Long;
|
|
|
|
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
|
|
|
use xCAT::Usage;
|
2009-12-10 02:19:40 +00:00
|
|
|
use xCAT::PPCinv;
|
2010-08-09 06:05:35 +00:00
|
|
|
use xCAT::FSPUtils;
|
|
|
|
#use Data::Dumper;
|
2009-12-02 09:41:06 +00:00
|
|
|
|
|
|
|
##########################################
|
|
|
|
# Maps fsp-api attributes to text
|
|
|
|
##########################################
|
|
|
|
my @licmap = (
|
|
|
|
["ecnumber", "Release Level "],
|
|
|
|
["activated_level", "Active Level "],
|
|
|
|
["installed_level", "Installed Level"],
|
|
|
|
["accepted_level", "Accepted Level "],
|
|
|
|
["curr_ecnumber_a", "Release Level A"],
|
|
|
|
["curr_level_a", "Level A "],
|
|
|
|
["curr_ecnumber_b", "Release Level B"],
|
|
|
|
["curr_level_b", "Level B "],
|
|
|
|
["curr_ecnumber_primary", "Release Level Primary"],
|
|
|
|
["curr_level_primary", "Level Primary "],
|
|
|
|
["curr_ecnumber_secondary","Release Level Secondary"],
|
|
|
|
["curr_level_secondary", "Level Secondary"]
|
|
|
|
);
|
|
|
|
|
2009-12-10 02:19:40 +00:00
|
|
|
##########################################################################
|
|
|
|
# Parse the command line for options and operands
|
|
|
|
##########################################################################
|
|
|
|
sub parse_args {
|
|
|
|
xCAT::PPCinv::parse_args(@_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-02 09:41:06 +00:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Returns FSP/BPA firmware information
|
|
|
|
##########################################################################
|
|
|
|
sub firmware {
|
|
|
|
|
|
|
|
my $request = shift;
|
|
|
|
my $hash = shift;
|
|
|
|
my @result;
|
|
|
|
|
2009-12-10 02:19:40 +00:00
|
|
|
# print "in FSPinv \n";
|
2009-12-02 09:41:06 +00:00
|
|
|
#print Dumper($request);
|
|
|
|
#print Dumper($hash);
|
|
|
|
|
|
|
|
####################################
|
2009-12-10 02:19:40 +00:00
|
|
|
# FSPinv with firm command is grouped by hardware control point
|
|
|
|
# In FSPinv, the hcp is the related fsp.
|
2009-12-02 09:41:06 +00:00
|
|
|
####################################
|
|
|
|
|
|
|
|
# Example of $hash.
|
|
|
|
#VAR1 = {
|
|
|
|
# '9110-51A*1075ECF' => {
|
|
|
|
# 'Server-9110-51A-SN1075ECF' => [
|
|
|
|
# 0,
|
|
|
|
# 0,
|
2009-12-10 02:19:40 +00:00
|
|
|
# '9110-51A*1075ECF',
|
|
|
|
# 'fsp1_name',
|
|
|
|
# 'fsp',
|
|
|
|
# 0
|
|
|
|
# ]
|
|
|
|
# }
|
2009-12-02 09:41:06 +00:00
|
|
|
# };
|
|
|
|
|
|
|
|
while (my ($mtms,$h) = each(%$hash) ) {
|
|
|
|
while (my ($name,$d) = each(%$h) ) {
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Command only supported on FSP/BPA/LPARs
|
|
|
|
#####################################
|
|
|
|
if ( @$d[4] !~ /^(fsp|bpa|lpar)$/ ) {
|
|
|
|
push @result,
|
|
|
|
[$name,"Information only available for CEC/BPA/LPAR",RC_ERROR];
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
#################
|
|
|
|
#For support on Lpars, the flag need to be changed.
|
|
|
|
##########
|
|
|
|
if(@$d[4] eq "lpar") {
|
|
|
|
@$d[4] = "fsp";
|
2010-02-26 09:42:41 +00:00
|
|
|
@$d[0] = 0;
|
2009-12-02 09:41:06 +00:00
|
|
|
}
|
2010-08-09 06:05:35 +00:00
|
|
|
my $values = xCAT::FSPUtils::fsp_api_action( $name, $d, "list_firmware_level");
|
2010-02-26 09:42:41 +00:00
|
|
|
my $Rc = @$values[2];
|
|
|
|
my $data = @$values[1];
|
2009-12-02 09:41:06 +00:00
|
|
|
#print "values";
|
|
|
|
#print Dumper($values);
|
2010-02-26 09:42:41 +00:00
|
|
|
#####################################
|
|
|
|
# Return error
|
|
|
|
#####################################
|
|
|
|
if ( $Rc != SUCCESS ) {
|
|
|
|
push @result, [$name,$data,$Rc];
|
2009-12-02 09:41:06 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Format fsp-api results
|
|
|
|
#####################################
|
2009-12-10 02:19:40 +00:00
|
|
|
my $val;
|
|
|
|
foreach $val ( @licmap ) {
|
2010-02-26 09:42:41 +00:00
|
|
|
if ( $data =~ /@$val[0]=(\w+)/ ) {
|
2009-12-10 02:19:40 +00:00
|
|
|
push @result, [$name,"@$val[1]: $1",$Rc];
|
2009-12-02 09:41:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return( \@result );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Returns firmware version
|
|
|
|
##########################################################################
|
|
|
|
sub firm {
|
|
|
|
return( firmware(@_) );
|
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Returns serial-number
|
|
|
|
##########################################################################
|
|
|
|
sub serial {
|
|
|
|
}
|
|
|
|
|
|
|
|
sub vpd {
|
|
|
|
}
|
|
|
|
|
|
|
|
sub bus {
|
|
|
|
}
|
|
|
|
|
|
|
|
sub config {
|
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Returns machine-type-model
|
|
|
|
##########################################################################
|
|
|
|
sub model {
|
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Returns all inventory information
|
|
|
|
##########################################################################
|
|
|
|
sub all {
|
|
|
|
|
|
|
|
my @result = (
|
|
|
|
@{vpd(@_)},
|
|
|
|
@{bus(@_)},
|
|
|
|
@{config(@_)},
|
|
|
|
@{firmware(@_)}
|
|
|
|
);
|
|
|
|
return( \@result );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
|