diff --git a/lib/SNMP/Info/Bridge.pm b/lib/SNMP/Info/Bridge.pm index ac6c0581..51b27d6c 100644 --- a/lib/SNMP/Info/Bridge.pm +++ b/lib/SNMP/Info/Bridge.pm @@ -721,7 +721,7 @@ tagged ports or the VLAN ID. =item $bridge->qb_fdb_index() -Returns reference to hash: key = VLAN ID, value = FDB ID. +Returns reference to hash: key = FDB ID, value = VLAN ID. =item $bridge->v_index() diff --git a/xt/lib/Test/SNMP/Info/Bridge.pm b/xt/lib/Test/SNMP/Info/Bridge.pm index 17a3c182..7cb5a597 100644 --- a/xt/lib/Test/SNMP/Info/Bridge.pm +++ b/xt/lib/Test/SNMP/Info/Bridge.pm @@ -47,9 +47,26 @@ sub setup : Tests(setup) { # Start with a common cache that will serve most tests my $cache_data = { - 'store' => {}, + '_dot1qVlanFdbId' =>1, + 'store' => { + 'dot1qVlanFdbId' => { '0.1' => 0, '0.91' => 3, '0.112' => 1, '0.113' => 2} + }, }; $test->{info}->cache($cache_data); } -1; \ No newline at end of file + +sub qb_fdb_index : Tests(3) { + my $test = shift; + + can_ok( $test->{info}, 'qb_fdb_index' ); + + my $expected = { 0 => 1, 3 => 91, 1 => 112, 2 => 113 }; + cmp_deeply( $test->{info}->qb_fdb_index(), $expected, q(FDB to VLAN index returned expected values)); + + $test->{info}->clear_cache(); + cmp_deeply( $test->{info}->qb_fdb_index(), + {}, q(No data returns empty hash) ); +} + +1;