diff --git a/Changes b/Changes index 02d99f2d..de72cf20 100644 --- a/Changes +++ b/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] diff --git a/lib/SNMP/Info/Layer3/Fortinet.pm b/lib/SNMP/Info/Layer3/Fortinet.pm index 4a3adb1c..38443f6f 100644 --- a/lib/SNMP/Info/Layer3/Fortinet.pm +++ b/lib/SNMP/Info/Layer3/Fortinet.pm @@ -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 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. + +=back + =head2 Table Methods imported from SNMP::Info::Layer3 See documentation in L for details.