make fortinet return a useful interface name. (#319)
* make fortinet return a useful interface name. also fixes missing interface issue due to being unable to map the port 'interfaces - ignoring 54 (no port mapping)'
This commit is contained in:
6
Changes
6
Changes
@@ -1,3 +1,9 @@
|
||||
Version 3.67 (2019-xx-xx)
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
* #319 make fortinet return a useful interface name (inphobia)
|
||||
|
||||
Version 3.66 (2019-03-24)
|
||||
|
||||
[NEW FEATURES]
|
||||
|
||||
@@ -63,6 +63,29 @@ sub vendor {
|
||||
return 'fortinet';
|
||||
}
|
||||
|
||||
# fortios 5.4 and higher can have empty ifDescr. use ifName (but
|
||||
# without the ifAlias fixup that's done in layer3::i_name()) which
|
||||
# mimics fortios >5.4
|
||||
# copied from an old Layer3.pm which did not have duplicate
|
||||
# description fixup
|
||||
sub interfaces {
|
||||
my $fortinet = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $fortinet->i_index($partial);
|
||||
my $descriptions = $fortinet->orig_i_name($partial);
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $fortinet = shift;
|
||||
my $id = $fortinet->id() || '';
|
||||
@@ -193,6 +216,14 @@ See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $fortinet->interfaces();
|
||||
|
||||
Returns the map between SNMP Interface Identifier (iid) and C<ifName>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
Reference in New Issue
Block a user