From 0ab688964f0ae3cad65a1cf97eb65eff45a67da9 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Sun, 6 May 2018 09:32:35 -0400 Subject: [PATCH] Don't capture 'Hive' if it exists in aerohive AP model name --- lib/SNMP/Info/Layer2/Aerohive.pm | 2 +- xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/SNMP/Info/Layer2/Aerohive.pm b/lib/SNMP/Info/Layer2/Aerohive.pm index 0cd8f9b1..3d931da9 100644 --- a/lib/SNMP/Info/Layer2/Aerohive.pm +++ b/lib/SNMP/Info/Layer2/Aerohive.pm @@ -106,7 +106,7 @@ sub model { my $aerohive = shift; my $descr = $aerohive->description(); - if ( $descr =~ m/\b((Hive|)AP\d+)\b/ix ) { + if ( $descr =~ m/\b(?:Hive|)(AP\d+)\b/ix ) { return $1; } return; diff --git a/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm b/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm index 6b29e776..67866d14 100644 --- a/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm +++ b/xt/lib/Test/SNMP/Info/Layer2/Aerohive.pm @@ -116,11 +116,16 @@ sub os_ver : Tests(3) { is($test->{info}->os_ver(), undef, q(No description returns undef os_ver)); } -sub model : Tests(3) { +sub model : Tests(4) { my $test = shift; can_ok($test->{info}, 'model'); - is($test->{info}->model(), 'AP121', q(Model is expected value)); + is($test->{info}->model(), + 'AP121', q(Model with 'Hive' in description sting is expected value)); + + $test->{info}{_description} = 'AP250, HiveOS 8.3r2 build-191018'; + is($test->{info}->model(), + 'AP250', q(Model without 'Hive' in description sting is expected value)); $test->{info}->clear_cache(); is($test->{info}->model(), undef, q(No description returns undef model));