line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Tools::AIX; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
6279272
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
398
|
|
4
|
9
|
|
|
9
|
|
51
|
use warnings; |
|
9
|
|
|
|
|
12
|
|
|
9
|
|
|
|
|
349
|
|
5
|
9
|
|
|
9
|
|
40
|
use base 'Exporter'; |
|
9
|
|
|
|
|
47
|
|
|
9
|
|
|
|
|
889
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
46
|
use English qw(-no_match_vars); |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
72
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
4129
|
use FusionInventory::Agent::Tools; |
|
9
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
1333
|
|
10
|
9
|
|
|
9
|
|
42
|
use Memoize; |
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
3251
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
13
|
|
|
|
|
|
|
getLsvpdInfos |
14
|
|
|
|
|
|
|
getAdaptersFromLsdev |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
memoize('getLsvpdInfos'); |
18
|
|
|
|
|
|
|
memoize('getAdaptersFromLsdev'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub getLsvpdInfos { |
21
|
|
|
|
|
|
|
my (%params) = ( |
22
|
|
|
|
|
|
|
command => 'lsvpd', |
23
|
|
|
|
|
|
|
@_ |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
27
|
|
|
|
|
|
|
return unless $handle; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my @devices; |
30
|
|
|
|
|
|
|
my $device; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# skip first lines |
33
|
|
|
|
|
|
|
while (my $line = <$handle>) { |
34
|
|
|
|
|
|
|
last if $line =~ /^\*FC \?+/; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
while (my $line = <$handle>) { |
38
|
|
|
|
|
|
|
if ($line =~ /^\*FC \?+/) { |
39
|
|
|
|
|
|
|
# block delimiter |
40
|
|
|
|
|
|
|
push @devices, $device; |
41
|
|
|
|
|
|
|
undef $device; |
42
|
|
|
|
|
|
|
next; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
chomp $line; |
46
|
|
|
|
|
|
|
next unless $line =~ /^\* ([A-Z]{2}) \s+ (.*\S)/x; |
47
|
|
|
|
|
|
|
$device->{$1} = $2; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
close $handle; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# last device |
52
|
|
|
|
|
|
|
push @devices, $device; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return @devices; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub getAdaptersFromLsdev { |
58
|
|
|
|
|
|
|
my (%params) = ( |
59
|
|
|
|
|
|
|
command => 'lsdev -Cc adapter -F "name:type:description"', |
60
|
|
|
|
|
|
|
@_ |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $handle = getFileHandle(%params); |
64
|
|
|
|
|
|
|
return unless $handle; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my @adapters; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
while (my $line = <$handle>) { |
69
|
|
|
|
|
|
|
chomp $line; |
70
|
|
|
|
|
|
|
my @info = split(/:/, $line); |
71
|
|
|
|
|
|
|
push @adapters, { |
72
|
|
|
|
|
|
|
NAME => $info[0], |
73
|
|
|
|
|
|
|
TYPE => $info[1], |
74
|
|
|
|
|
|
|
DESCRIPTION => $info[2] |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
close $handle; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return @adapters; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |