| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::SNMP::Mixin::Dot1abLldp; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
407523
|
use strict; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
132
|
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
200
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# store this package name in a handy variable, |
|
8
|
|
|
|
|
|
|
# used for unambiguous prefix of mixin attributes |
|
9
|
|
|
|
|
|
|
# storage in object hash |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
my $prefix = __PACKAGE__; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# this module import config |
|
15
|
|
|
|
|
|
|
# |
|
16
|
4
|
|
|
4
|
|
25
|
use Carp (); |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
113
|
|
|
17
|
4
|
|
|
4
|
|
601
|
use Net::SNMP::Mixin::Util qw/normalize_mac idx2val push_error get_init_slot/; |
|
|
4
|
|
|
|
|
96334
|
|
|
|
4
|
|
|
|
|
45
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# this module export config |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
my @mixin_methods; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
BEGIN { |
|
25
|
4
|
|
|
4
|
|
2583
|
@mixin_methods = ( |
|
26
|
|
|
|
|
|
|
qw/ |
|
27
|
|
|
|
|
|
|
get_lldp_local_system_data |
|
28
|
|
|
|
|
|
|
get_lldp_loc_port_table |
|
29
|
|
|
|
|
|
|
get_lldp_rem_table |
|
30
|
|
|
|
|
|
|
map_lldp_loc_portid2portnum |
|
31
|
|
|
|
|
|
|
/ |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
42
|
use Sub::Exporter -setup => { |
|
36
|
|
|
|
|
|
|
exports => [@mixin_methods], |
|
37
|
|
|
|
|
|
|
groups => { default => [@mixin_methods], }, |
|
38
|
4
|
|
|
4
|
|
35
|
}; |
|
|
4
|
|
|
|
|
12
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
# SNMP oid constants used in this module |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# from lldpMIB |
|
44
|
|
|
|
|
|
|
use constant { |
|
45
|
4
|
|
|
|
|
4115
|
LLDP_LOCAL_SYSTEM_DATA => '1.0.8802.1.1.2.1.3', |
|
46
|
|
|
|
|
|
|
LLDP_LOCAL_CHASSIS_ID_SUBTYPE => '1.0.8802.1.1.2.1.3.1.0', |
|
47
|
|
|
|
|
|
|
LLDP_LOCAL_CHASSIS_ID => '1.0.8802.1.1.2.1.3.2.0', |
|
48
|
|
|
|
|
|
|
LLDP_LOCAL_SYS_NAME => '1.0.8802.1.1.2.1.3.3.0', |
|
49
|
|
|
|
|
|
|
LLDP_LOCAL_SYS_DESC => '1.0.8802.1.1.2.1.3.4.0', |
|
50
|
|
|
|
|
|
|
LLDP_LOCAL_SYS_CAPA_SUP => '1.0.8802.1.1.2.1.3.5.0', |
|
51
|
|
|
|
|
|
|
LLDP_LOCAL_SYS_CAPA_ENA => '1.0.8802.1.1.2.1.3.6.0', |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
LLDP_LOC_PORT_TABLE => '1.0.8802.1.1.2.1.3.7', |
|
54
|
|
|
|
|
|
|
LLDP_LOC_PORT_NUM => '1.0.8802.1.1.2.1.3.7.1.1', |
|
55
|
|
|
|
|
|
|
LLDP_LOC_PORT_ID_SUBTYPE => '1.0.8802.1.1.2.1.3.7.1.2', |
|
56
|
|
|
|
|
|
|
LLDP_LOC_PORT_ID => '1.0.8802.1.1.2.1.3.7.1.3', |
|
57
|
|
|
|
|
|
|
LLDP_LOC_PORT_DESC => '1.0.8802.1.1.2.1.3.7.1.4', |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
LLDP_REM_TABLE => '1.0.8802.1.1.2.1.4.1', |
|
60
|
|
|
|
|
|
|
LLDP_REM_LOCAL_PORT_NUM => '1.0.8802.1.1.2.1.4.1.1.2', |
|
61
|
|
|
|
|
|
|
LLDP_REM_CHASSIS_ID_SUBTYPE => '1.0.8802.1.1.2.1.4.1.1.4', |
|
62
|
|
|
|
|
|
|
LLDP_REM_CHASSIS_ID => '1.0.8802.1.1.2.1.4.1.1.5', |
|
63
|
|
|
|
|
|
|
LLDP_REM_PORT_ID_SUBTYPE => '1.0.8802.1.1.2.1.4.1.1.6', |
|
64
|
|
|
|
|
|
|
LLDP_REM_PORT_ID => '1.0.8802.1.1.2.1.4.1.1.7', |
|
65
|
|
|
|
|
|
|
LLDP_REM_PORT_DESC => '1.0.8802.1.1.2.1.4.1.1.8', |
|
66
|
|
|
|
|
|
|
LLDP_REM_SYS_NAME => '1.0.8802.1.1.2.1.4.1.1.9', |
|
67
|
|
|
|
|
|
|
LLDP_REM_SYS_DESC => '1.0.8802.1.1.2.1.4.1.1.10', |
|
68
|
|
|
|
|
|
|
LLDP_REM_SYS_CAPA_SUP => '1.0.8802.1.1.2.1.4.1.1.11', |
|
69
|
|
|
|
|
|
|
LLDP_REM_SYS_CAPA_ENA => '1.0.8802.1.1.2.1.4.1.1.12', |
|
70
|
4
|
|
|
4
|
|
2539
|
}; |
|
|
4
|
|
|
|
|
9
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Net::SNMP::Mixin::Dot1abLldp - mixin class for the Link Layer Discovery Protocol |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
A Net::SNMP mixin class for LLDP (Link Layer Discovery Protocol) based info. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
use Net::SNMP; |
|
85
|
|
|
|
|
|
|
use Net::SNMP::Mixin; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#... |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $session = Net::SNMP->session( -hostname => 'foo.bar.com' ); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$session->mixer('Net::SNMP::Mixin::Dot1abLldp'); |
|
92
|
|
|
|
|
|
|
$session->init_mixins; |
|
93
|
|
|
|
|
|
|
snmp_dispatcher(); |
|
94
|
|
|
|
|
|
|
$session->init_ok(); |
|
95
|
|
|
|
|
|
|
die $session->errors if $session->errors; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
printf "Local ChassisID: %s\n", |
|
98
|
|
|
|
|
|
|
$session->get_lldp_local_system_data->{lldpLocChassisId}; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$lldp_loc_port_tbl = $session->get_lldp_loc_port_table; |
|
101
|
|
|
|
|
|
|
$lldp_rem_tbl = $session->get_lldp_rem_table; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
foreach $lport ( keys %$lldp_rem_tbl ) { |
|
104
|
|
|
|
|
|
|
foreach $idx ( keys %{ $lldp_rem_tbl->{$lport} } ) { |
|
105
|
|
|
|
|
|
|
my $lldpRemSysName = $lldp_rem_tbl->{$lport}{$idx}{lldpRemSysName}; |
|
106
|
|
|
|
|
|
|
my $lldpRemPortId = $lldp_rem_tbl->{$lport}{$idx}{lldpRemPortId}; |
|
107
|
|
|
|
|
|
|
my $lldpRemPortDesc = $lldp_rem_tbl->{$lport}{$idx}{lldpRemPortDesc}; |
|
108
|
|
|
|
|
|
|
my $lldpRemChassisId = $lldp_rem_tbl->{$lport}{$idx}{lldpRemChassisId}; |
|
109
|
|
|
|
|
|
|
my $ldesc = $lldp_loc_port_tbl->{$lport}{lldpLocPortDesc}; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
printf "$lport:$ldesc => $lldpRemSysName:$lldpRemPortId:$lldpRemPortDesc:$lldpRemChassisId\n"; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
With this mixin it's simple to explore the Layer-2 topologie of the network. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The LLDP (Link Layer Discovery Protocol) is an IEEE (Draft?) standard for vendor-independent Layer-2 discovery, similar to the proprietary CDP (Cisco Discovery Protocol) from Cisco. It's defined in the IEEE 802.1AB documents, therefore the name of this module. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This mixin reads data from the B<< lldpLocalSystemData >>, B<< lldpLocPortTable >> and the B<< lldpRemTable >> out of the LLDP-MIB. At least these values are in the mandatory set of the LLDP-MIB. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 MIXIN METHODS |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 B<< OBJ->get_lldp_local_system_data() >> |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns the LLDP lldpLocalSystemData group as a hash reference: |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
{ |
|
132
|
|
|
|
|
|
|
lldpLocChassisIdSubtype => Integer, |
|
133
|
|
|
|
|
|
|
lldpLocChassisId => OCTET_STRING, |
|
134
|
|
|
|
|
|
|
lldpLocSysName => OCTET_STRING, |
|
135
|
|
|
|
|
|
|
lldpLocSysDesc => OCTET_STRING, |
|
136
|
|
|
|
|
|
|
lldpLocSysCapSupported => BITS, |
|
137
|
|
|
|
|
|
|
lldpLocSysCapEnabled => BITS, |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub get_lldp_local_system_data { |
|
143
|
1
|
|
|
1
|
1
|
34802
|
my $session = shift; |
|
144
|
1
|
|
|
|
|
8
|
my $agent = $session->hostname; |
|
145
|
|
|
|
|
|
|
|
|
146
|
1
|
50
|
|
|
|
13
|
Carp::croak "$agent: '$prefix' not initialized," |
|
147
|
|
|
|
|
|
|
unless $session->init_ok($prefix); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# just a shallow copy for shallow values |
|
150
|
0
|
|
|
|
|
0
|
my $result = { %{ $session->{$prefix}{locSysData} } }; |
|
|
0
|
|
|
|
|
0
|
|
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# if the chassisIdSubtype has the enumeration 'macAddress(4)' |
|
153
|
|
|
|
|
|
|
# we normalize the MacAddress |
|
154
|
|
|
|
|
|
|
$result->{lldpLocChassisId} = normalize_mac( $result->{lldpLocChassisId} ) |
|
155
|
0
|
0
|
0
|
|
|
0
|
if defined $result->{lldpLocChassisIdSubtype} && $result->{lldpLocChassisIdSubtype} == 4; |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
0
|
return $result; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 B<< OBJ->get_lldp_loc_port_table() >> |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Returns the LLDP lldp_loc_port_table as a hash reference. The table is indexed by the LLDP local port numbers: |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
{ |
|
165
|
|
|
|
|
|
|
lldpLocPortNum => { |
|
166
|
|
|
|
|
|
|
lldpLocPortIdSubtype => INTEGER, |
|
167
|
|
|
|
|
|
|
lldpLocPortId => OCTET_STRING, |
|
168
|
|
|
|
|
|
|
lldpLocPortDesc => OCTET_STRING, |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
The LLDP portnumber isn't necessarily the ifIndex of the switch. See the TEXTUAL-CONVENTION from the LLDP-MIB: |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
"A port number has no mandatory relationship to an |
|
175
|
|
|
|
|
|
|
InterfaceIndex object (of the interfaces MIB, IETF RFC 2863). |
|
176
|
|
|
|
|
|
|
If the LLDP agent is a IEEE 802.1D, IEEE 802.1Q bridge, the |
|
177
|
|
|
|
|
|
|
LldpPortNumber will have the same value as the dot1dBasePort |
|
178
|
|
|
|
|
|
|
object (defined in IETF RFC 1493) associated corresponding |
|
179
|
|
|
|
|
|
|
bridge port. If the system hosting LLDP agent is not an |
|
180
|
|
|
|
|
|
|
IEEE 802.1D or an IEEE 802.1Q bridge, the LldpPortNumber |
|
181
|
|
|
|
|
|
|
will have the same value as the corresponding interface's |
|
182
|
|
|
|
|
|
|
InterfaceIndex object." |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
See also the L<< Net::SNMP::Mixin::Dot1dBase >> for a mixin to get the mapping between the ifIndexes and the dot1dBasePorts if needed. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub get_lldp_loc_port_table { |
|
189
|
1
|
|
|
1
|
1
|
766
|
my $session = shift; |
|
190
|
1
|
|
|
|
|
7
|
my $agent = $session->hostname; |
|
191
|
|
|
|
|
|
|
|
|
192
|
1
|
50
|
|
|
|
11
|
Carp::croak "$agent: '$prefix' not initialized," |
|
193
|
|
|
|
|
|
|
unless $session->init_ok($prefix); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# stash for return values |
|
196
|
0
|
|
|
|
|
0
|
my $result = {}; |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
# |
|
199
|
|
|
|
|
|
|
# the MIB tables are stored in {column}{row}{value} order |
|
200
|
|
|
|
|
|
|
# but we return {row}{column}{value} |
|
201
|
|
|
|
|
|
|
# |
|
202
|
|
|
|
|
|
|
# grab all rows from one choosen column |
|
203
|
0
|
|
|
|
|
0
|
my @rows = keys %{ $session->{$prefix}{lldpLocPortTbl}{lldpLocPortId} }; |
|
|
0
|
|
|
|
|
0
|
|
|
204
|
|
|
|
|
|
|
|
|
205
|
0
|
|
|
|
|
0
|
foreach my $row (@rows) { |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
# loop over all columns |
|
208
|
0
|
|
|
|
|
0
|
foreach my $column ( keys %{ $session->{$prefix}{lldpLocPortTbl} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
# rebuild in reverse order: result(row,column) = stash(column,row) |
|
211
|
|
|
|
|
|
|
# side effect: make a shallow copy for shallow values |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
$result->{$row}{$column} = |
|
214
|
0
|
|
|
|
|
0
|
$session->{$prefix}{lldpLocPortTbl}{$column}{$row}; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
return $result; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 B<< OBJ->map_lldp_loc_portid2portnum() >> |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Returns a hash reference with local portIds to local portNums: |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
{ |
|
227
|
|
|
|
|
|
|
... |
|
228
|
|
|
|
|
|
|
Te5/32 => 234, |
|
229
|
|
|
|
|
|
|
... |
|
230
|
|
|
|
|
|
|
} |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=cut |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub map_lldp_loc_portid2portnum { |
|
235
|
1
|
|
|
1
|
1
|
769
|
my $session = shift; |
|
236
|
1
|
|
|
|
|
6
|
my $agent = $session->hostname; |
|
237
|
|
|
|
|
|
|
|
|
238
|
1
|
50
|
|
|
|
8
|
Carp::croak "$agent: '$prefix' not initialized," |
|
239
|
|
|
|
|
|
|
unless $session->init_ok($prefix); |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
# stash for return values |
|
242
|
0
|
|
|
|
|
0
|
my $result = {}; |
|
243
|
|
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
0
|
foreach my $portNum ( keys %{ $session->{$prefix}{lldpLocPortTbl}{lldpLocPortId} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
245
|
0
|
|
|
|
|
0
|
my $portId = $session->{$prefix}{lldpLocPortTbl}{lldpLocPortId}{$portNum}; |
|
246
|
0
|
|
|
|
|
0
|
$result->{$portId} = $portNum; |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
|
|
|
|
0
|
return $result; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 B<< OBJ->get_lldp_rem_table() >> |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Returns the LLDP lldp_rem_table as a hash reference. The table is indexed by the LLDP local port numbers on which the remote system information is received and an index for multiple neighbors on one port: |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
{ |
|
257
|
|
|
|
|
|
|
lldpRemLocalPortNum => { |
|
258
|
|
|
|
|
|
|
lldpRemIndex => { |
|
259
|
|
|
|
|
|
|
lldpRemChassisIdSubtype => INTEGER, |
|
260
|
|
|
|
|
|
|
lldpRemChassisId => OCTET_STRING, |
|
261
|
|
|
|
|
|
|
lldpRemPortIdSubtype => INTEGER, |
|
262
|
|
|
|
|
|
|
lldpRemPortId => OCTET_STRING, |
|
263
|
|
|
|
|
|
|
lldpRemPortDesc => OCTET_STRING, |
|
264
|
|
|
|
|
|
|
lldpRemSysName => OCTET_STRING, |
|
265
|
|
|
|
|
|
|
lldpRemSysDesc => OCTET_STRING, |
|
266
|
|
|
|
|
|
|
lldpRemSysCapSupported => BITS, |
|
267
|
|
|
|
|
|
|
lldpRemSysCapEnabled => BITS, |
|
268
|
|
|
|
|
|
|
} |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=cut |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub get_lldp_rem_table { |
|
275
|
1
|
|
|
1
|
1
|
763
|
my $session = shift; |
|
276
|
1
|
|
|
|
|
14
|
my $agent = $session->hostname; |
|
277
|
|
|
|
|
|
|
|
|
278
|
1
|
50
|
|
|
|
7
|
Carp::croak "$agent: '$prefix' not initialized," |
|
279
|
|
|
|
|
|
|
unless $session->init_ok($prefix); |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
# stash for return values |
|
282
|
0
|
|
|
|
|
0
|
my $result = {}; |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# the MIB tables are stored in {column}{row}{value} order |
|
285
|
|
|
|
|
|
|
# but we return {row}{column}{value} |
|
286
|
|
|
|
|
|
|
# |
|
287
|
|
|
|
|
|
|
# grab all rows from one random choosen column |
|
288
|
0
|
|
|
|
|
0
|
my @rows = keys %{ $session->{$prefix}{lldpRemTbl}{lldpRemPortId} }; |
|
|
0
|
|
|
|
|
0
|
|
|
289
|
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
0
|
foreach my $row (@rows) { |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
# the rows are the concatenation of 'lldpRemLocalPortNum.lldpRemIndex' |
|
293
|
|
|
|
|
|
|
# split them into separate values |
|
294
|
0
|
|
|
|
|
0
|
my ( $lldpRemLocalPortNum, $lldpRemIndex ) = split /\./, $row; |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
# loop over all columns |
|
297
|
0
|
|
|
|
|
0
|
foreach my $column ( keys %{ $session->{$prefix}{lldpRemTbl} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# rebuild in reverse order: result(row,column) = stash(column,row) |
|
300
|
|
|
|
|
|
|
# side effect: make a shallow copy for shallow values |
|
301
|
|
|
|
|
|
|
# side effect: entangle the row 'lldpRemLocalPortNum.lldpRemIndex' |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
$result->{$lldpRemLocalPortNum}{$lldpRemIndex}{$column} = |
|
304
|
0
|
|
|
|
|
0
|
$session->{$prefix}{lldpRemTbl}{$column}{$row}; |
|
305
|
|
|
|
|
|
|
} |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
# if the chassisIdSubtype has the enumeration 'macAddress(4)' |
|
308
|
|
|
|
|
|
|
# we normalize the MacAddress |
|
309
|
|
|
|
|
|
|
my $chassisIdSubtype = |
|
310
|
0
|
|
|
|
|
0
|
$result->{$lldpRemLocalPortNum}{$lldpRemIndex}{lldpRemChassisIdSubtype}; |
|
311
|
|
|
|
|
|
|
|
|
312
|
0
|
0
|
0
|
|
|
0
|
if ( defined $chassisIdSubtype && $chassisIdSubtype == 4 ) { |
|
313
|
|
|
|
|
|
|
$result->{$lldpRemLocalPortNum}{$lldpRemIndex}{lldpRemChassisId} = |
|
314
|
0
|
|
|
|
|
0
|
normalize_mac( $result->{$lldpRemLocalPortNum}{$lldpRemIndex}{lldpRemChassisId} ); |
|
315
|
|
|
|
|
|
|
} |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
0
|
|
|
|
|
0
|
return $result; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=head1 INITIALIZATION |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head2 B<< OBJ->_init($reload) >> |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Fetch the LLDP related snmp values from the host. Don't call this method direct! |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=cut |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
# |
|
331
|
|
|
|
|
|
|
# due to the asynchron nature, we don't know what init job is really the last, we decrement |
|
332
|
|
|
|
|
|
|
# the value after each callback |
|
333
|
|
|
|
|
|
|
# |
|
334
|
4
|
|
|
4
|
|
36
|
use constant THIS_INIT_JOBS => 3; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
5261
|
|
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub _init { |
|
337
|
4
|
|
|
4
|
|
12334
|
my ( $session, $reload ) = @_; |
|
338
|
4
|
|
|
|
|
13
|
my $agent = $session->hostname; |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
die "$agent: $prefix already initialized and reload not forced.\n" |
|
341
|
|
|
|
|
|
|
if exists get_init_slot($session)->{$prefix} |
|
342
|
4
|
50
|
66
|
|
|
28
|
&& get_init_slot($session)->{$prefix} == 0 |
|
|
|
|
33
|
|
|
|
|
|
343
|
|
|
|
|
|
|
&& not $reload; |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# set number of async init jobs for proper initialization |
|
346
|
4
|
|
|
|
|
111
|
get_init_slot($session)->{$prefix} = THIS_INIT_JOBS; |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
# populate the object with needed mib values |
|
349
|
|
|
|
|
|
|
# |
|
350
|
|
|
|
|
|
|
# initialize the object for LLDP infos |
|
351
|
4
|
|
|
|
|
48
|
_fetch_lldp_local_system_data($session); |
|
352
|
4
|
100
|
|
|
|
29
|
return if $session->error; |
|
353
|
|
|
|
|
|
|
|
|
354
|
2
|
|
|
|
|
18
|
_fetch_lldp_loc_port_tbl($session); |
|
355
|
2
|
50
|
|
|
|
13
|
return if $session->error; |
|
356
|
|
|
|
|
|
|
|
|
357
|
2
|
|
|
|
|
33
|
_fetch_lldp_rem_tbl($session); |
|
358
|
2
|
50
|
|
|
|
29
|
return if $session->error; |
|
359
|
|
|
|
|
|
|
|
|
360
|
2
|
|
|
|
|
18
|
return 1; |
|
361
|
|
|
|
|
|
|
} |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Only for developers or maintainers. |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=head2 B<< _fetch_lldp_local_system_data($session) >> |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Fetch the local system data from the lldpMIB once during object initialization. |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub _fetch_lldp_local_system_data { |
|
374
|
4
|
|
|
4
|
|
10
|
my $session = shift; |
|
375
|
4
|
|
|
|
|
19
|
my $result; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
# use get_entries instead of get_request since the |
|
378
|
|
|
|
|
|
|
# result will be true in case of missing values |
|
379
|
|
|
|
|
|
|
# the values are just noSuchObject |
|
380
|
|
|
|
|
|
|
# with get_entries() we get error messages for free |
|
381
|
|
|
|
|
|
|
|
|
382
|
4
|
50
|
|
|
|
21
|
$result = $session->get_entries( |
|
|
|
100
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
-columns => [ LLDP_LOCAL_SYSTEM_DATA, ], |
|
384
|
|
|
|
|
|
|
-endindex => '6.0', # LLDP_LOCAL_SYS_CAPA_ENA |
|
385
|
|
|
|
|
|
|
( $session->version != 0 ? ( -maxrepetitions => 10 ) : () ), |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
# define callback if in nonblocking mode |
|
388
|
|
|
|
|
|
|
$session->nonblocking ? ( -callback => \&_lldp_local_system_data_cb ) : (), |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
); |
|
391
|
|
|
|
|
|
|
|
|
392
|
4
|
100
|
|
|
|
2011297
|
unless ( defined $result ) { |
|
393
|
2
|
50
|
|
|
|
18
|
if ( my $err_msg = $session->error ) { |
|
394
|
2
|
|
|
|
|
71
|
push_error( $session, "$prefix: $err_msg" ); |
|
395
|
|
|
|
|
|
|
} |
|
396
|
2
|
|
|
|
|
185
|
return; |
|
397
|
|
|
|
|
|
|
} |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
# in nonblocking mode the callback will be called asynchronously |
|
400
|
2
|
50
|
|
|
|
10
|
return 1 if $session->nonblocking; |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
# ok we are in synchronous mode, call the result mangling function |
|
403
|
|
|
|
|
|
|
# by hand |
|
404
|
0
|
|
|
|
|
0
|
_lldp_local_system_data_cb($session); |
|
405
|
|
|
|
|
|
|
} |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head2 B<< _lldp_local_system_data_cb($session) >> |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
The callback for _fetch_lldp_local_system_data. |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=cut |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
sub _lldp_local_system_data_cb { |
|
414
|
2
|
|
|
2
|
|
2005987
|
my $session = shift; |
|
415
|
2
|
|
|
|
|
15
|
my $vbl = $session->var_bind_list; |
|
416
|
|
|
|
|
|
|
|
|
417
|
2
|
50
|
|
|
|
33
|
unless ( defined $vbl ) { |
|
418
|
2
|
50
|
|
|
|
14
|
if ( my $err_msg = $session->error ) { |
|
419
|
2
|
|
|
|
|
45
|
push_error( $session, "$prefix: $err_msg" ); |
|
420
|
|
|
|
|
|
|
} |
|
421
|
2
|
|
|
|
|
98
|
return; |
|
422
|
|
|
|
|
|
|
} |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocChassisIdSubtype} = |
|
425
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_CHASSIS_ID_SUBTYPE() }; |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocChassisId} = |
|
428
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_CHASSIS_ID() }; |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocSysName} = |
|
431
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_SYS_NAME() }; |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocSysDesc} = |
|
434
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_SYS_DESC() }; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocSysCapSupported} = |
|
437
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_SYS_CAPA_SUP() }; |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
$session->{$prefix}{locSysData}{lldpLocSysCapEnabled} = |
|
440
|
0
|
|
|
|
|
0
|
$vbl->{ LLDP_LOCAL_SYS_CAPA_ENA() }; |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
# this init job is finished |
|
443
|
0
|
|
|
|
|
0
|
get_init_slot($session)->{$prefix}--; |
|
444
|
|
|
|
|
|
|
|
|
445
|
0
|
|
|
|
|
0
|
return 1; |
|
446
|
|
|
|
|
|
|
} |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head2 B<< _fetch_lldp_loc_port_tbl($session) >> |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
Fetch the lldpLocPortTable once during object initialization. |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=cut |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
sub _fetch_lldp_loc_port_tbl { |
|
455
|
2
|
|
|
2
|
|
5
|
my $session = shift; |
|
456
|
2
|
|
|
|
|
4
|
my $result; |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
# fetch the lldpLocPortTable |
|
459
|
2
|
50
|
|
|
|
8
|
$result = $session->get_table( |
|
|
|
50
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
-baseoid => LLDP_LOC_PORT_TABLE, |
|
461
|
|
|
|
|
|
|
( $session->version != 0 ? ( -maxrepetitions => 10 ) : () ), |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
# define callback if in nonblocking mode |
|
464
|
|
|
|
|
|
|
$session->nonblocking ? ( -callback => \&_lldp_loc_port_tbl_cb ) : (), |
|
465
|
|
|
|
|
|
|
); |
|
466
|
|
|
|
|
|
|
|
|
467
|
2
|
50
|
|
|
|
2031
|
unless ( defined $result ) { |
|
468
|
0
|
0
|
|
|
|
0
|
if ( my $err_msg = $session->error ) { |
|
469
|
0
|
|
|
|
|
0
|
push_error( $session, "$prefix: $err_msg" ); |
|
470
|
|
|
|
|
|
|
} |
|
471
|
0
|
|
|
|
|
0
|
return; |
|
472
|
|
|
|
|
|
|
} |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
# in nonblocking mode the callback will be called asynchronously |
|
475
|
2
|
50
|
|
|
|
9
|
return 1 if $session->nonblocking; |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
# ok we are in synchronous mode, call the result mangling function |
|
478
|
|
|
|
|
|
|
# by hand |
|
479
|
0
|
|
|
|
|
0
|
_lldp_loc_port_tbl_cb($session); |
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=head2 B<< _lldp_loc_port_tbl_cb($session) >> |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
The callback for _fetch_lldp_loc_port_tbl_cb(). |
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
=cut |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
sub _lldp_loc_port_tbl_cb { |
|
490
|
2
|
|
|
2
|
|
1456
|
my $session = shift; |
|
491
|
2
|
|
|
|
|
11
|
my $vbl = $session->var_bind_list; |
|
492
|
|
|
|
|
|
|
|
|
493
|
2
|
50
|
|
|
|
34
|
unless ( defined $vbl ) { |
|
494
|
2
|
50
|
|
|
|
11
|
if ( my $err_msg = $session->error ) { |
|
495
|
2
|
|
|
|
|
29
|
push_error( $session, "$prefix: $err_msg" ); |
|
496
|
|
|
|
|
|
|
} |
|
497
|
2
|
|
|
|
|
108
|
return; |
|
498
|
|
|
|
|
|
|
} |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
# mangle result table to get plain idx->value |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
$session->{$prefix}{lldpLocPortTbl}{lldpLocPortIdSubtype} = |
|
503
|
0
|
|
|
|
|
0
|
idx2val( $vbl, LLDP_LOC_PORT_ID_SUBTYPE ); |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
$session->{$prefix}{lldpLocPortTbl}{lldpLocPortId} = |
|
506
|
0
|
|
|
|
|
0
|
idx2val( $vbl, LLDP_LOC_PORT_ID ); |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
$session->{$prefix}{lldpLocPortTbl}{lldpLocPortDesc} = |
|
509
|
0
|
|
|
|
|
0
|
idx2val( $vbl, LLDP_LOC_PORT_DESC ); |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
# this init job is finished |
|
512
|
0
|
|
|
|
|
0
|
get_init_slot($session)->{$prefix}--; |
|
513
|
|
|
|
|
|
|
|
|
514
|
0
|
|
|
|
|
0
|
return 1; |
|
515
|
|
|
|
|
|
|
} |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=head2 B<< _fetch_lldp_rem_tbl($session) >> |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
Fetch the lldpRemTable once during object initialization. |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=cut |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
sub _fetch_lldp_rem_tbl { |
|
524
|
2
|
|
|
2
|
|
5
|
my $session = shift; |
|
525
|
2
|
|
|
|
|
6
|
my $result; |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
# fetch the lldpRemTable |
|
528
|
2
|
50
|
|
|
|
10
|
$result = $session->get_table( |
|
|
|
50
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
-baseoid => LLDP_REM_TABLE, |
|
530
|
|
|
|
|
|
|
( $session->version != 0 ? ( -maxrepetitions => 10 ) : () ), |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
# define callback if in nonblocking mode |
|
533
|
|
|
|
|
|
|
$session->nonblocking ? ( -callback => \&_lldp_rem_tbl_cb ) : (), |
|
534
|
|
|
|
|
|
|
); |
|
535
|
|
|
|
|
|
|
|
|
536
|
2
|
50
|
|
|
|
2141
|
unless ( defined $result ) { |
|
537
|
0
|
0
|
|
|
|
0
|
if ( my $err_msg = $session->error ) { |
|
538
|
0
|
|
|
|
|
0
|
push_error( $session, "$prefix: $err_msg" ); |
|
539
|
|
|
|
|
|
|
} |
|
540
|
0
|
|
|
|
|
0
|
return; |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
# in nonblocking mode the callback will be called asynchronously |
|
544
|
2
|
50
|
|
|
|
8
|
return 1 if $session->nonblocking; |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
# ok we are in synchronous mode, call the result mangling function |
|
547
|
|
|
|
|
|
|
# by hand |
|
548
|
0
|
|
|
|
|
0
|
_lldp_rem_tbl_cb($session); |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
} |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=head2 B<< _lldp_rem_tbl_cb($session) >> |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
The callback for _fetch_lldp_rem_tbl_cb(). |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=cut |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
sub _lldp_rem_tbl_cb { |
|
559
|
2
|
|
|
2
|
|
1194
|
my $session = shift; |
|
560
|
2
|
|
|
|
|
9
|
my $vbl = $session->var_bind_list; |
|
561
|
|
|
|
|
|
|
|
|
562
|
2
|
50
|
|
|
|
26
|
unless ( defined $vbl ) { |
|
563
|
2
|
50
|
|
|
|
9
|
if ( my $err_msg = $session->error ) { |
|
564
|
2
|
|
|
|
|
44
|
push_error( $session, "$prefix: $err_msg" ); |
|
565
|
|
|
|
|
|
|
} |
|
566
|
2
|
|
|
|
|
144
|
return; |
|
567
|
|
|
|
|
|
|
} |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
# mangle result table to get plain idx->value |
|
570
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
|
571
|
|
|
|
|
|
|
# the tableIndex is a little bit tricky, please see the LLDP-MIB |
|
572
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
|
573
|
|
|
|
|
|
|
# |
|
574
|
|
|
|
|
|
|
# .1.0.8802.1.1.2.1.4.1.1.11[.0.20.1] |
|
575
|
|
|
|
|
|
|
# ^ ^ ^ |
|
576
|
|
|
|
|
|
|
# | | | |
|
577
|
|
|
|
|
|
|
# lldpRemTimeMark---/ | | |
|
578
|
|
|
|
|
|
|
# | | |
|
579
|
|
|
|
|
|
|
# lldpRemLocalPortNum--/ | |
|
580
|
|
|
|
|
|
|
# | |
|
581
|
|
|
|
|
|
|
# lldpRemIndex-----------/ |
|
582
|
|
|
|
|
|
|
# |
|
583
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
|
584
|
|
|
|
|
|
|
# lldpRemEntry OBJECT-TYPE |
|
585
|
|
|
|
|
|
|
# SYNTAX LldpRemEntry |
|
586
|
|
|
|
|
|
|
# MAX-ACCESS not-accessible |
|
587
|
|
|
|
|
|
|
# STATUS current |
|
588
|
|
|
|
|
|
|
# DESCRIPTION |
|
589
|
|
|
|
|
|
|
# "Information about a particular physical network connection. |
|
590
|
|
|
|
|
|
|
# Entries may be created and deleted in this table by the agent, |
|
591
|
|
|
|
|
|
|
# if a physical topology discovery process is active." |
|
592
|
|
|
|
|
|
|
# INDEX { |
|
593
|
|
|
|
|
|
|
# lldpRemTimeMark, |
|
594
|
|
|
|
|
|
|
# lldpRemLocalPortNum, |
|
595
|
|
|
|
|
|
|
# lldpRemIndex |
|
596
|
|
|
|
|
|
|
# } |
|
597
|
|
|
|
|
|
|
# ::= { lldpRemTable 1 } |
|
598
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
# mangle result table to get plain idx->value |
|
601
|
|
|
|
|
|
|
# cut off the variable lldpRemTimeMark as pre |
|
602
|
|
|
|
|
|
|
# |
|
603
|
|
|
|
|
|
|
# result hashes: lldpRemLocalPortNum.lldpRemIndex => values |
|
604
|
|
|
|
|
|
|
# |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemChassisIdSubtype} = |
|
607
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_CHASSIS_ID_SUBTYPE, 1, undef, ); |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemChassisId} = |
|
610
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_CHASSIS_ID, 1, undef, ); |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemPortIdSubtype} = |
|
613
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_PORT_ID_SUBTYPE, 1, undef, ); |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemPortId} = |
|
616
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_PORT_ID, 1, undef, ); |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemPortDesc} = |
|
619
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_PORT_DESC, 1, undef, ); |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemSysName} = |
|
622
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_SYS_NAME, 1, undef, ); |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemSysDesc} = |
|
625
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_SYS_DESC, 1, undef, ); |
|
626
|
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemSysCapSupported} = |
|
628
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_SYS_CAPA_SUP, 1, undef, ); |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
$session->{$prefix}{lldpRemTbl}{lldpRemSysCapEnabled} = |
|
631
|
0
|
|
|
|
|
|
idx2val( $vbl, LLDP_REM_SYS_CAPA_ENA, 1, undef, ); |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
# this init job is finished |
|
634
|
0
|
|
|
|
|
|
get_init_slot($session)->{$prefix}--; |
|
635
|
|
|
|
|
|
|
|
|
636
|
0
|
|
|
|
|
|
return 1; |
|
637
|
|
|
|
|
|
|
} |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
unless ( caller() ) { |
|
640
|
|
|
|
|
|
|
print "$prefix compiles and initializes successful.\n"; |
|
641
|
|
|
|
|
|
|
} |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
L<< Net::SNMP::Mixin::Dot1dBase >> |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
=head1 REQUIREMENTS |
|
648
|
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
L<< Net::SNMP >>, L<< Net::SNMP::Mixin >> |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
=head1 BUGS, PATCHES & FIXES |
|
652
|
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
There are no known bugs at the time of this release. However, if you spot a bug or are experiencing difficulties that are not explained within the POD documentation, please submit a bug to the RT system (see link below). However, it would help greatly if you are able to pinpoint problems or even supply a patch. |
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
Fixes are dependant upon their severity and my availablity. Should a fix not be forthcoming, please feel free to (politely) remind me by sending an email to gaissmai@cpan.org . |
|
656
|
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
RT: http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SNMP-Mixin-Dot1abLldp |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=head1 AUTHOR |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
Karl Gaissmaier |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Copyright 2008-2021 Karl Gaissmaier, all rights reserved. |
|
667
|
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
669
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
670
|
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
=cut |
|
672
|
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
1; |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
# vim: sw=2 |