add link aggregation for fortios (#437)

* lag support for fortigate

* a few more tests

* mention fortinet lag
This commit is contained in:
nick n
2021-09-12 21:01:11 +02:00
committed by GitHub
parent afc8eefaf1
commit 6dc369efbc
3 changed files with 86 additions and 7 deletions

View File

@@ -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]

View File

@@ -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<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
See L<SNMP::Info::Aggregate/"Required MIBs"> 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<ifName>.
=item C<agg_ports>
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

View File

@@ -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;