line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Tools::Hardware::Brocade; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25012786
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
356
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub run { |
7
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
my $snmp = $params{snmp}; |
10
|
0
|
|
|
|
|
|
my $device = $params{device}; |
11
|
0
|
|
|
|
|
|
my $logger = $params{logger}; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
my $ports = $device->{PORTS}->{PORT}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $wwns = getConnectedWWNs( |
16
|
|
|
|
|
|
|
snmp => $params{snmp}, |
17
|
0
|
|
|
|
|
|
); |
18
|
0
|
0
|
|
|
|
|
return unless $wwns; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $fc_ports = getFcPorts($ports); |
21
|
0
|
0
|
|
|
|
|
return unless $fc_ports; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
foreach my $idx (keys %$wwns) { |
24
|
0
|
0
|
|
|
|
|
if (!$ports->{$fc_ports->{$idx}}) { |
25
|
0
|
0
|
|
|
|
|
$logger->error("non-existing FC port $idx") |
26
|
|
|
|
|
|
|
if $logger; |
27
|
0
|
|
|
|
|
|
last; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
my $port = $ports->{$fc_ports->{$idx}}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
push @{$port->{CONNECTIONS}->{CONNECTION}->{MAC}}, $wwns->{$idx}; |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub getFcPorts { |
36
|
0
|
|
|
0
|
0
|
|
my ($ports) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my %fcPort; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# map each IFMIB port to FIBRE-CHANNEL-FE-MIB port |
41
|
0
|
|
|
|
|
|
my $i = 1; # fc ports count from 1 |
42
|
0
|
|
|
|
|
|
foreach my $idx (sort keys %$ports) { |
43
|
0
|
0
|
|
|
|
|
if ($ports->{$idx}->{IFTYPE} == 56) { # fibreChannel |
44
|
0
|
|
|
|
|
|
$fcPort{$i} = $idx; |
45
|
0
|
|
|
|
|
|
$i++; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return \%fcPort; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub getConnectedWWNs { |
53
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $snmp = $params{snmp}; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
my $results; |
58
|
0
|
|
|
|
|
|
my $fcFxPortNxPortName = $snmp->walk(".1.3.6.1.2.1.75.1.2.3.1.10"); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# .1.3.6.1.2.1.75.1.2.3.1.10.1.1.1 = Hex-STRING: 21 00 00 24 FF 57 5D 9C |
61
|
|
|
|
|
|
|
# .1.3.6.1.2.1.75.1.2.3.1.10.1.2.1 = Hex-STRING: 21 00 00 24 FF 57 5F 18 |
62
|
|
|
|
|
|
|
# ^--- $idx |
63
|
0
|
|
|
|
|
|
while (my ($suffix, $wwn) = each %$fcFxPortNxPortName) { |
64
|
0
|
|
|
|
|
|
$wwn = FusionInventory::Agent::Tools::Hardware::_getCanonicalMacAddress($wwn); |
65
|
0
|
0
|
|
|
|
|
next unless $wwn; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $idx = FusionInventory::Agent::Tools::Hardware::_getElement($suffix, 1); |
68
|
0
|
0
|
|
|
|
|
next unless $idx; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
push @{$results->{$idx}}, $wwn; |
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $results; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
__END__ |