line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Tools::Hardware::Qlogic; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24856718
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
379
|
|
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 $fc_ports = getFcPorts( |
16
|
|
|
|
|
|
|
snmp => $params{snmp}, |
17
|
0
|
|
|
|
|
|
); |
18
|
0
|
0
|
|
|
|
|
return unless $fc_ports; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $connected_wwns = getConnectedWWNs( |
21
|
|
|
|
|
|
|
snmp => $params{snmp}, |
22
|
0
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $port_status = getFcPortStatus( |
25
|
|
|
|
|
|
|
snmp => $params{snmp}, |
26
|
0
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
foreach my $idx (keys %$fc_ports) { |
29
|
|
|
|
|
|
|
# Generate ifNumber for FC ports to avoid confusion with |
30
|
|
|
|
|
|
|
# ethernet ports numbers |
31
|
0
|
|
|
|
|
|
my $port_id = sprintf("10%02d00", $idx); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$ports->{$port_id} = { |
34
|
|
|
|
|
|
|
IFNUMBER => $port_id, |
35
|
|
|
|
|
|
|
IFTYPE => 56, # fibreChannel |
36
|
|
|
|
|
|
|
IFNAME => "FC port $idx", |
37
|
|
|
|
|
|
|
MAC => $fc_ports->{$idx}, |
38
|
0
|
|
|
|
|
|
IFSTATUS => $port_status->{$idx}, |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if (defined $connected_wwns->{$idx}) { |
42
|
|
|
|
|
|
|
$ports->{$port_id}->{CONNECTIONS}->{CONNECTION}->{MAC} = |
43
|
0
|
|
|
|
|
|
[ $connected_wwns->{$idx} ]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub getFcPorts { |
49
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $snmp = $params{snmp}; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my %fcPort; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $fcFxPortName = $snmp->walk(".1.3.6.1.2.1.75.1.1.5.1.2.1"); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#FIBRE-CHANNEL-FE-MIB::fcFxPortName.1.1 = Hex-STRING: 20 00 00 C0 DD 0C C5 27 |
58
|
|
|
|
|
|
|
#FIBRE-CHANNEL-FE-MIB::fcFxPortName.1.2 = Hex-STRING: 20 01 00 C0 DD 0C C5 27 |
59
|
0
|
|
|
|
|
|
while (my ($idx, $wwn) = each %$fcFxPortName) { |
60
|
0
|
|
|
|
|
|
$wwn = FusionInventory::Agent::Tools::Hardware::_getCanonicalMacAddress($wwn); |
61
|
0
|
0
|
|
|
|
|
next unless $wwn; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$fcPort{$idx} = $wwn; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return \%fcPort; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub getFcPortStatus { |
70
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $snmp = $params{snmp}; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $fcFxPortPhysOperStatus = $snmp->walk(".1.3.6.1.2.1.75.1.2.2.1.2.1"); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $fcFxPortPhysOperStatus; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub getConnectedWWNs { |
80
|
0
|
|
|
0
|
0
|
|
my (%params) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $snmp = $params{snmp}; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $results; |
85
|
0
|
|
|
|
|
|
my $fcFxPortNxPortName = $snmp->walk(".1.3.6.1.2.1.75.1.2.3.1.10.1"); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# .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 |
88
|
|
|
|
|
|
|
# .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 |
89
|
0
|
|
|
|
|
|
while (my ($suffix, $wwn) = each %$fcFxPortNxPortName) { |
90
|
0
|
|
|
|
|
|
$wwn = FusionInventory::Agent::Tools::Hardware::_getCanonicalMacAddress($wwn); |
91
|
0
|
0
|
|
|
|
|
next unless $wwn; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my $idx = FusionInventory::Agent::Tools::Hardware::_getElement($suffix, 0); |
94
|
0
|
0
|
|
|
|
|
next unless $idx; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
push @{$results->{$idx}}, $wwn; |
|
0
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $results; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
__END__ |