File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/HPUX/MP.pm
Criterion Covered Total %
statement 14 20 70.0
branch 0 2 0.0
condition 0 3 0.0
subroutine 6 8 75.0
pod 0 2 0.0
total 20 35 57.1


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::HPUX::MP;
2              
3 2     2   82241482 use strict;
  2         4  
  2         57  
4 2     2   7 use warnings;
  2         3  
  2         76  
5              
6 2     2   746 use FusionInventory::Agent::Tools;
  2         4  
  2         272  
7 2     2   745 use FusionInventory::Agent::Tools::Network;
  2         4  
  2         568  
8              
9             #TODO driver pcislot virtualdev
10              
11             sub isEnabled {
12             return
13 0   0 0 0 0 canRun('/opt/hpsmh/data/htdocs/comppage/getMPInfo.cgi') ||
14             canRun('/opt/sfm/bin/CIMUtil');
15             }
16              
17             sub doInventory {
18 0     0 0 0 my (%params) = @_;
19              
20 0         0 my $inventory = $params{inventory};
21 0         0 my $logger = $params{logger};
22              
23 0 0       0 my $ipaddress = canRun('/opt/hpsmh/data/htdocs/comppage/getMPInfo.cgi') ?
24             _parseGetMPInfo(logger => $logger) : _parseCIMUtil(logger => $logger);
25              
26 0         0 $inventory->addEntry(
27             section => 'NETWORKS',
28             entry => {
29             DESCRIPTION => 'Management Interface - HP MP',
30             TYPE => 'Ethernet',
31             MANAGEMENT => 'MP',
32             IPADDRESS => $ipaddress,
33             }
34             );
35              
36             }
37              
38             sub _parseGetMPInfo {
39 1     1   385 return getFirstMatch(
40             command => '/opt/hpsmh/data/htdocs/comppage/getMPInfo.cgi',
41             pattern => qr{RIBLink = "https?://($ip_address_pattern)";},
42             @_
43             );
44             }
45              
46             sub _parseCIMUtil {
47 1     1   503 return getFirstMatch(
48             command => '/opt/sfm/bin/CIMUtil -e root/cimv2 HP_ManagementProcessor',
49             pattern => qr{^IPAddress\s+:\s+($ip_address_pattern)},
50             @_
51             );
52             }
53              
54             1;