From 42395d49fd49ee7cba5dcb9e6c8e75e22918ea90 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sun, 14 Apr 2019 22:27:40 +0200 Subject: [PATCH] fix regression test for aerohive (#322) --- Changes | 2 ++ xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Changes b/Changes index de72cf20..308f82e8 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ Version 3.67 (2019-xx-xx) [BUG FIXES] * #319 make fortinet return a useful interface name (inphobia) + * #496 aerohive corrupts snmp cache, for reload, makes reporting + wireless clients work. (inphobia) Version 3.66 (2019-03-24) diff --git a/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm b/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm index b0908909..e7ca5e81 100644 --- a/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm +++ b/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm @@ -243,11 +243,23 @@ sub bp_index : Tests(3) { can_ok($test->{info}, 'bp_index'); + # aerohive->bp_index uses load_i_index, which clears cached data, so + # mock up the needed snmp data. + my $data + = {'IF-MIB::ifIndex' => + {4 => 4, 6 => 6, 7 => 7, 9 => 9, 15 => 15, 16 => 16, 20 => 20} + }; + $test->{info}{sess}{Data} = $data; + my $expected = {4 => 4, 6 => 6, 7 => 7, 9 => 9, 15 => 15, 16 => 16, 20 => 20}; cmp_deeply($test->{info}->bp_index(), $expected, q(Bridge interface mapping has expected values)); + # and now delete the data so we can test for empty returns + delete $test->{info}{_i_index}; + delete $test->{info}{store}{i_index}; + $test->{info}{sess}{Data} = {}; $test->{info}->clear_cache(); cmp_deeply($test->{info}->bp_index(), {}, q(No data returns empty hash)); }