#306 fix incorrect interfaces for d-link

This commit is contained in:
Oliver Gorwits
2019-04-20 09:42:43 +01:00
parent 75785f70c7
commit 9b1995e90f
2 changed files with 26 additions and 1 deletions

View File

@@ -91,6 +91,16 @@ sub model {
}
}
# ifDescr is the same for all interfaces in a class, but the ifName is
# unique, so let's use that for port name.
sub interfaces {
my $dlink = shift;
my $partial = shift;
my $interfaces = $dlink->orig_i_name($partial);
return $interfaces;
}
sub vendor {
return 'dlink';

View File

@@ -49,12 +49,27 @@ sub setup : Tests(setup) {
my $cache_data = {
'_layers' => 4,
'_description' => 'DGS-3620-28SC Gigabit Ethernet Switch',
'_i_name' => 1,
# SWDGS3620PRIMGMT-MIB::dlink-Dgs3620Prod-Dgs3620-28SC
'_id' => '.1.3.6.1.4.1.171.10.118.2',
'store' => {},
'store' => {
i_name => { 1 => 'One', 2 => 'Two' },
},
};
$test->{info}->cache($cache_data);
}
sub interfaces : Tests(1) {
my $test = shift;
my $expected_data = {
1 => 'One',
2 => 'Two',
};
cmp_deeply($test->{info}->interfaces(),
$expected_data, 'Call to interfaces() returns ifName');
}
1;