diff --git a/Changes b/Changes index 90228940..d3aeda42 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,10 @@ +Version 3.79 (2021-xx-xx) + + [ENHANCEMENTS] + + * layer3::fortinet now supports link aggregation mapping + + Version 3.78 (2021-09-08) [BUG FIXES] diff --git a/lib/SNMP/Info/Layer3/Fortinet.pm b/lib/SNMP/Info/Layer3/Fortinet.pm index 3cfe2e72..14a897f1 100644 --- a/lib/SNMP/Info/Layer3/Fortinet.pm +++ b/lib/SNMP/Info/Layer3/Fortinet.pm @@ -33,9 +33,13 @@ use strict; use warnings; use Exporter; use SNMP::Info::Layer3; +use SNMP::Info::Aggregate 'agg_ports_ifstack'; -@SNMP::Info::Layer3::Fortinet::ISA - = qw/SNMP::Info::Layer3 Exporter/; +@SNMP::Info::Layer3::Fortinet::ISA = qw/ + SNMP::Info::Layer3 + SNMP::Info::Aggregate + Exporter +/; @SNMP::Info::Layer3::Fortinet::EXPORT_OK = qw//; our ($VERSION, %GLOBALS, %FUNCS, %MIBS, %MUNGE); @@ -44,6 +48,7 @@ $VERSION = '3.78'; %MIBS = ( %SNMP::Info::Layer3::MIBS, + %SNMP::Info::Aggregate::MIBS, 'FORTINET-CORE-MIB' => 'fnSysSerial', 'FORTINET-FORTIGATE-MIB' => 'fgVdMaxVdoms', ); @@ -121,6 +126,8 @@ sub serial { return $fortinet->fnSysSerial(); } +sub agg_ports { return agg_ports_ifstack(@_) } + 1; __END__ @@ -157,6 +164,8 @@ Abstraction subclass for Fortinet network devices. =item SNMP::Info::Layer3 +=item SNMP::Info::Aggregate + =back =head2 Required MIBs @@ -171,6 +180,8 @@ Abstraction subclass for Fortinet network devices. See L for its own MIB requirements. +See L for its own MIB requirements. + =back =head1 GLOBALS @@ -218,6 +229,12 @@ to a hash. Returns the map between SNMP Interface Identifier (iid) and C. +=item C + +Returns a HASH reference mapping from slave to master port for each member of +a port bundle on the device. Keys are ifIndex of the slave ports, Values are +ifIndex of the corresponding master ports. + =back =head2 Table Methods imported from SNMP::Info::Layer3 diff --git a/xt/lib/Test/SNMP/Info/Layer3/Fortinet.pm b/xt/lib/Test/SNMP/Info/Layer3/Fortinet.pm index a4043d76..9eec3b00 100644 --- a/xt/lib/Test/SNMP/Info/Layer3/Fortinet.pm +++ b/xt/lib/Test/SNMP/Info/Layer3/Fortinet.pm @@ -48,15 +48,70 @@ sub setup : Tests(setup) { # Start with a common cache that will serve most tests my $cache_data = { '_layers' => 78, + '_description' => 'firewall', - # Example snmpwalk had null string in sysDescr.0 - '_description' => '', + # FORTINET-FORTIGATE-MIB::fgt500E + '_id' => '.1.3.6.1.4.1.12356.101.1.5005', - # FORTINET-FORTIGATE-MIB::fgt60D - '_id' => '.1.3.6.1.4.1.12356.101.1.625', - 'store' => {}, + '_fnSysSerial' => 'FG5H0E5810000000', + '_fgSysVersion' => 'v6.0.11,build0387,200917 (GA)', + '_i_index' => 1, + '_orig_i_name' => 1, + 'store' => { + 'i_index' => { + 1 => 1, + 2 => 2, + 3 => 3 + }, + 'orig_i_name' => { + 1 => "ha", + 2 => "mgmt", + 3 => "port1" + }, + }, }; $test->{info}->cache($cache_data); } +sub vendor : Tests(2) { + my $test = shift; + + can_ok($test->{info}, 'vendor'); + is($test->{info}->vendor(), 'fortinet', q(Vendor returns 'fortinet')); +} + +sub model : Tests(3) { + my $test = shift; + + can_ok($test->{info}, 'model'); + is($test->{info}->model(), '500E', q(Model is expected value)); + + $test->{info}->clear_cache(); + is($test->{info}->model(), '', q(No model info returns undef model)); +} + +sub os : Tests(2) { + my $test = shift; + + can_ok($test->{info}, 'os'); + is($test->{info}->os(), 'fortios', q(os returns 'fortios')); +} + +sub os_ver : Tests(3) { + my $test = shift; + + can_ok($test->{info}, 'os_ver'); + is($test->{info}->os_ver(), '6.0.11', q(os_ver is expected value)); + + $test->{info}->clear_cache(); + is($test->{info}->os_ver(), '', q(No os_ver info returns undef os_ver)); +} + +sub serial : Tests(2) { + my $test = shift; + + can_ok($test->{info}, 'serial'); + is($test->{info}->serial(), 'FG5H0E5810000000', q(serial number is expected value')); +} + 1;