line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Networks::FibreChannel; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
119674830
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
369
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
720
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
0
|
return canRun('systool'); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub doInventory { |
13
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
16
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
my @interfaces = _getInterfacesFromFcHost(logger => $logger); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
foreach my $interface (@interfaces) { |
21
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
22
|
|
|
|
|
|
|
section => 'NETWORKS', |
23
|
|
|
|
|
|
|
entry => $interface |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _getInterfacesFromFcHost { |
29
|
1
|
|
|
1
|
|
9
|
my (%params) = ( |
30
|
|
|
|
|
|
|
command => 'systool -c fc_host -v', |
31
|
|
|
|
|
|
|
@_ |
32
|
|
|
|
|
|
|
); |
33
|
1
|
|
|
|
|
3
|
my $handle = getFileHandle(%params); |
34
|
1
|
50
|
|
|
|
3
|
return unless $handle; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
2
|
my @interfaces; |
37
|
|
|
|
|
|
|
my $interface; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
8
|
while (my $line = <$handle>) { |
40
|
60
|
100
|
|
|
|
187
|
if ($line =~ /Class Device = "(.+)"/) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
41
|
2
|
|
|
|
|
10
|
$interface = { |
42
|
|
|
|
|
|
|
DESCRIPTION => $1, |
43
|
|
|
|
|
|
|
TYPE => 'fibrechannel' |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
} elsif ($line =~ /port_name\s+= "0x(\w+)"/) { |
46
|
2
|
|
|
|
|
18
|
$interface->{'WWN'} = join(':', unpack '(A2)*', $1); |
47
|
|
|
|
|
|
|
} elsif ($line =~ /port_state\s+= "(\w+)"/) { |
48
|
2
|
50
|
|
|
|
5
|
if ($1 eq 'Online') { |
|
|
0
|
|
|
|
|
|
49
|
2
|
|
|
|
|
5
|
$interface->{'STATUS'} = 'Up'; |
50
|
|
|
|
|
|
|
} elsif ($1 eq 'Linkdown') { |
51
|
0
|
|
|
|
|
0
|
$interface->{'STATUS'} = 'Down'; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} elsif ($line =~ /speed\s+= "(.+)"/) { |
54
|
2
|
50
|
|
|
|
7
|
$interface->{'SPEED'} = getCanonicalInterfaceSpeed($1) |
55
|
|
|
|
|
|
|
if ($1 ne 'unknown'); |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
6
|
push @interfaces, $interface; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
10
|
return @interfaces; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |