line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::Linux::Networks::FibreChannel; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
145719942
|
use strict; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
102
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
160
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
705
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
1167
|
|
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
|
|
13
|
my (%params) = ( |
30
|
|
|
|
|
|
|
command => 'systool -c fc_host -v', |
31
|
|
|
|
|
|
|
@_ |
32
|
|
|
|
|
|
|
); |
33
|
1
|
|
|
|
|
7
|
my $handle = getFileHandle(%params); |
34
|
1
|
50
|
|
|
|
5
|
return unless $handle; |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
2
|
my @interfaces; |
37
|
|
|
|
|
|
|
my $interface; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
13
|
while (my $line = <$handle>) { |
40
|
60
|
100
|
|
|
|
323
|
if ($line =~ /Class Device = "(.+)"/) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
41
|
2
|
|
|
|
|
15
|
$interface = { |
42
|
|
|
|
|
|
|
DESCRIPTION => $1, |
43
|
|
|
|
|
|
|
TYPE => 'fibrechannel' |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
} elsif ($line =~ /port_name\s+= "0x(\w+)"/) { |
46
|
2
|
|
|
|
|
46
|
$interface->{'WWN'} = join(':', unpack '(A2)*', $1); |
47
|
|
|
|
|
|
|
} elsif ($line =~ /port_state\s+= "(\w+)"/) { |
48
|
2
|
50
|
|
|
|
7
|
if ($1 eq 'Online') { |
|
|
0
|
|
|
|
|
|
49
|
2
|
|
|
|
|
9
|
$interface->{'STATUS'} = 'Up'; |
50
|
|
|
|
|
|
|
} elsif ($1 eq 'Linkdown') { |
51
|
0
|
|
|
|
|
0
|
$interface->{'STATUS'} = 'Down'; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} elsif ($line =~ /speed\s+= "(.+)"/) { |
54
|
2
|
50
|
|
|
|
11
|
$interface->{'SPEED'} = getCanonicalInterfaceSpeed($1) |
55
|
|
|
|
|
|
|
if ($1 ne 'unknown'); |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
9
|
push @interfaces, $interface; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
13
|
return @interfaces; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |