Use consistent return values and provide default initalizations
Add inital versions of Layer 2 test classes
This commit is contained in:
@@ -200,6 +200,8 @@ sub set_i_duplex_admin {
|
|||||||
|
|
||||||
my $iid = $c1900->c1900_p_ifindex($port);
|
my $iid = $c1900->c1900_p_ifindex($port);
|
||||||
|
|
||||||
|
return 0 unless $iid->{$port};
|
||||||
|
|
||||||
$duplex = lc($duplex);
|
$duplex = lc($duplex);
|
||||||
|
|
||||||
return 0 unless defined $duplexes{$duplex};
|
return 0 unless defined $duplexes{$duplex};
|
||||||
@@ -218,11 +220,11 @@ sub i_vlan {
|
|||||||
|| 'disabled';
|
|| 'disabled';
|
||||||
|
|
||||||
if ( $overlap eq 'enabled' ) {
|
if ( $overlap eq 'enabled' ) {
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
||||||
|| $c1900->vlanMemberPortOfVlan();
|
|| $c1900->vlanMemberPortOfVlan() || {};
|
||||||
|
|
||||||
my $i_pvid = {};
|
my $i_pvid = {};
|
||||||
foreach my $idx ( keys %$member_of ) {
|
foreach my $idx ( keys %$member_of ) {
|
||||||
@@ -244,7 +246,7 @@ sub i_vlan_membership {
|
|||||||
my $partial = shift;
|
my $partial = shift;
|
||||||
|
|
||||||
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
my $member_of = $c1900->bridgeGroupMemberPortOfBridgeGroup()
|
||||||
|| $c1900->vlanMemberPortOfVlan();
|
|| $c1900->vlanMemberPortOfVlan() || {};
|
||||||
|
|
||||||
my $i_vlan_membership = {};
|
my $i_vlan_membership = {};
|
||||||
foreach my $idx ( keys %$member_of ) {
|
foreach my $idx ( keys %$member_of ) {
|
||||||
@@ -261,7 +263,7 @@ sub i_vlan_membership {
|
|||||||
return $i_vlan_membership;
|
return $i_vlan_membership;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub i_vlan_membership_untagged { return; }
|
sub i_vlan_membership_untagged { return {}; }
|
||||||
|
|
||||||
sub bp_index {
|
sub bp_index {
|
||||||
my $c1900 = shift;
|
my $c1900 = shift;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ sub set_i_duplex_admin {
|
|||||||
return $c2900->set_c2900_p_duplex_admin( $duplexes{$duplex}, $iid );
|
return $c2900->set_c2900_p_duplex_admin( $duplexes{$duplex}, $iid );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use i_descritption for port key, cuz i_name can be manually entered.
|
# Use i_description for port key, cuz i_name can be manually entered.
|
||||||
sub interfaces {
|
sub interfaces {
|
||||||
my $c2900 = shift;
|
my $c2900 = shift;
|
||||||
my $partial = shift;
|
my $partial = shift;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ $VERSION = '3.54';
|
|||||||
sub i_physical {
|
sub i_physical {
|
||||||
my $cat = shift;
|
my $cat = shift;
|
||||||
|
|
||||||
my $p_port = $cat->p_port();
|
my $p_port = $cat->p_port() || {};
|
||||||
|
|
||||||
my %i_physical;
|
my %i_physical;
|
||||||
foreach my $port ( keys %$p_port ) {
|
foreach my $port ( keys %$p_port ) {
|
||||||
@@ -104,8 +104,8 @@ sub os_ver {
|
|||||||
# Workaround for incomplete bp_index
|
# Workaround for incomplete bp_index
|
||||||
sub bp_index {
|
sub bp_index {
|
||||||
my $cat = shift;
|
my $cat = shift;
|
||||||
my $p_index = $cat->p_port();
|
my $p_index = $cat->p_port() || {};
|
||||||
my $b_index = $cat->p_oidx();
|
my $b_index = $cat->p_oidx() || {};
|
||||||
|
|
||||||
my %bp_index;
|
my %bp_index;
|
||||||
foreach my $iid ( keys %$p_index ) {
|
foreach my $iid ( keys %$p_index ) {
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ sub os_ver {
|
|||||||
if ( $descr =~ /^\S+\s\S+\s\S+\s(\S+)/){
|
if ( $descr =~ /^\S+\s\S+\s\S+\s(\S+)/){
|
||||||
return $1;
|
return $1;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub serial {
|
sub serial {
|
||||||
@@ -75,7 +76,7 @@ sub serial {
|
|||||||
my $str = substr($1,8,10);
|
my $str = substr($1,8,10);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
sub vendor {
|
sub vendor {
|
||||||
return 'Kentrox';
|
return 'Kentrox';
|
||||||
@@ -87,6 +88,7 @@ sub model {
|
|||||||
if ( $descr =~ /^(\S+\s\S+)/){
|
if ( $descr =~ /^(\S+\s\S+)/){
|
||||||
return $1;
|
return $1;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
269
xt/lib/Test/SNMP/Info/Layer2/C1900.pm
Normal file
269
xt/lib/Test/SNMP/Info/Layer2/C1900.pm
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::C1900
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::C1900;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::C1900;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 11,
|
||||||
|
'_description' => 'Cisco Systems Catalyst 1900,V9.00.06 ',
|
||||||
|
|
||||||
|
# CISCO-STACK-MIB::wsc1900sysID
|
||||||
|
'_id' => '.1.3.6.1.4.1.9.5.18',
|
||||||
|
'_c1900_flash_status' => 'V9.00.06 written from 100.200.003.004',
|
||||||
|
'_bridgeGroupAllowMembershipOverlap' => 'disabled',
|
||||||
|
'_i_index' => 1,
|
||||||
|
'_i_description' => 1,
|
||||||
|
'_i_name' => 1,
|
||||||
|
'_c1900_p_ifindex' => 1,
|
||||||
|
'_c1900_p_duplex' => 1,
|
||||||
|
'_c1900_p_duplex_admin' => 1,
|
||||||
|
'_c1900_p_name' => 1,
|
||||||
|
'_bridgeGroupMemberPortOfBridgeGroup' => 1,
|
||||||
|
'store' => {
|
||||||
|
'i_index' => {1 => 1, 2 => 2, 3 => 3, 4 => 4},
|
||||||
|
'i_description' => {1 => 1, 2 => 2, 3 => 3, 4 => 4},
|
||||||
|
'i_name' => {1 => 1, 2 => 2, 3 => 3, 4 => 'AUI'},
|
||||||
|
'c1900_p_ifindex' => {1 => 1, 2 => 2, 3 => 3, 4 => 4},
|
||||||
|
'c1900_p_duplex' => {
|
||||||
|
1 => 'full-duplex',
|
||||||
|
2 => 'half-duplex',
|
||||||
|
3 => 'full-duplex',
|
||||||
|
4 => 'half-duplex',
|
||||||
|
},
|
||||||
|
'c1900_p_duplex_admin' =>
|
||||||
|
{1 => 'enabled', 2 => 'disabled', 3 => 'flow control', 4 => 'auto',},
|
||||||
|
'c1900_p_name' => {1 => 'My Port Name', 2 => undef, 3 => ' ', 4 => '',},
|
||||||
|
'bridgeGroupMemberPortOfBridgeGroup' => {
|
||||||
|
'1.1' => 'true',
|
||||||
|
'1.2' => 'true',
|
||||||
|
'1.3' => 'false',
|
||||||
|
'1.4' => 'false',
|
||||||
|
'2.1' => 'false',
|
||||||
|
'2.2' => 'false',
|
||||||
|
'2.3' => 'true',
|
||||||
|
'2.4' => 'false',
|
||||||
|
'3.1' => 'false',
|
||||||
|
'3.2' => 'false',
|
||||||
|
'3.3' => 'false',
|
||||||
|
'3.4' => 'true',
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub bulkwalk_no : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok $test->{info}, 'bulkwalk_no';
|
||||||
|
is($test->{info}->bulkwalk_no(), 1, 'Bulkwalk turned off in this class');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cisco_comm_indexing : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok $test->{info}, 'cisco_comm_indexing';
|
||||||
|
is($test->{info}->cisco_comm_indexing(), 1, 'Cisco community indexing on');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'cisco', q(Vendor returns 'cisco'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'catalyst', q(Vendor returns 'catalyst'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os_ver : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os_ver');
|
||||||
|
is($test->{info}->os_ver(), '9.00.06', q(OS version is expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->os_ver(), undef,
|
||||||
|
q(No description returns undef OS version));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub interfaces : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'interfaces');
|
||||||
|
|
||||||
|
my $expected = {1 => 1, 2 => 2, 3 => 3, 4 => 4,};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->interfaces(),
|
||||||
|
$expected, q(Interfaces have expected values));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_duplex : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_duplex');
|
||||||
|
|
||||||
|
my $expected = {1 => 'full', 2 => 'half', 3 => 'full', 4 => 'half',};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_duplex(),
|
||||||
|
$expected, q(Interfaces have expected duplex values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_duplex(),
|
||||||
|
{}, q(No duplex data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_duplex_admin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_duplex_admin');
|
||||||
|
|
||||||
|
my $expected = {1 => 'full', 2 => 'half', 3 => 'full', 4 => 'auto',};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_duplex_admin(),
|
||||||
|
$expected, q(Interfaces have expected duplex admin values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_duplex_admin(),
|
||||||
|
{}, q(No duplex admin data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_name : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_name');
|
||||||
|
|
||||||
|
my $expected = {1 => 'My Port Name', 2 => 2, 3 => 3, 4 => 'AUI',};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_name(),
|
||||||
|
$expected, q(Interfaces have expected name values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_name(), {}, q(No name data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_i_duplex_admin : Tests(4) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
# Set method uses a partial fetch which ignores the cache and reloads data
|
||||||
|
# therefore we must use the mocked session.
|
||||||
|
my $data = {
|
||||||
|
|
||||||
|
# This is defined in %FUNCS as c1900_p_ifindex
|
||||||
|
'STAND-ALONE-ETHERNET-SWITCH-MIB::swPortIfIndex' =>
|
||||||
|
{1 => 1, 2 => 2, 3 => 3, 4 => 4},
|
||||||
|
};
|
||||||
|
$test->{info}{sess}{Data} = $data;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'set_i_duplex_admin');
|
||||||
|
|
||||||
|
is($test->{info}->set_i_duplex_admin('full', 2),
|
||||||
|
1, q(Mock set duplex call succeeded));
|
||||||
|
|
||||||
|
is($test->{info}->set_i_duplex_admin('full', 5),
|
||||||
|
0, q(Mock set duplex call to non-existant port fails));
|
||||||
|
|
||||||
|
is($test->{info}->set_i_duplex_admin('full-x', 2),
|
||||||
|
0, q(Mock set duplex call to bad duplex type 'full-x' fails));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_vlan : Tests(4) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_vlan');
|
||||||
|
|
||||||
|
my $expected = {1 => 1, 2 => 1, 3 => 2, 4 => 3};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_vlan(),
|
||||||
|
$expected, q(Interfaces have expected PVID values));
|
||||||
|
|
||||||
|
delete $test->{info}{'_bridgeGroupAllowMembershipOverlap'};
|
||||||
|
$test->{info}{'_vlanAllowMembershipOverlap'} = 'enabled';
|
||||||
|
cmp_deeply($test->{info}->i_vlan(),
|
||||||
|
{}, q(VLAN overlap enabled returns empty hash));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_vlan(), {}, q(No VLAN data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_vlan_membership : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_vlan_membership');
|
||||||
|
|
||||||
|
my $expected = {1 => [1], 2 => [1], 3 => [2], 4 => [3]};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_vlan_membership(),
|
||||||
|
$expected, q(Interfaces have expected VLAN values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_vlan_membership(),
|
||||||
|
{}, q(No VLAN data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_vlan_membership_untagged : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_vlan_membership_untagged');
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_vlan_membership_untagged(),
|
||||||
|
{}, q(VLAN untagged membership not applicable returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub bp_index : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'bp_index');
|
||||||
|
|
||||||
|
my $expected = {1 => 1, 2 => 2, 3 => 3, 4 => 4,};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->bp_index(),
|
||||||
|
$expected, q(Interfaces have expected name values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->bp_index(),
|
||||||
|
{}, q(No bridge index data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
176
xt/lib/Test/SNMP/Info/Layer2/C2900.pm
Normal file
176
xt/lib/Test/SNMP/Info/Layer2/C2900.pm
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::C2900
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::C2900;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::C2900;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $d_string = 'Cisco Internetwork Operating System Software ';
|
||||||
|
$d_string .= 'IOS (tm) C2900XL Software (C2900XL-C3H2S-M), ';
|
||||||
|
$d_string .= 'Version 12.0(5)XU, RELEASE SOFTWARE (fc1)';
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => $d_string,
|
||||||
|
|
||||||
|
# CISCO-PRODUCTS-MIB::catalyst2924MXL
|
||||||
|
'_id' => '.1.3.6.1.4.1.9.1.220',
|
||||||
|
'_i_index' => 1,
|
||||||
|
'_i_description' => 1,
|
||||||
|
'_c2900_p_index' => 1,
|
||||||
|
'_c2900_p_duplex' => 1,
|
||||||
|
'_c2900_p_duplex_admin' => 1,
|
||||||
|
'_c2900_p_speed_admin' => 1,
|
||||||
|
'_p_port' => 1,
|
||||||
|
'store' => {
|
||||||
|
'i_index' => {2 => 2, 3 => 3, 26 => 26},
|
||||||
|
'i_description' => {
|
||||||
|
2 => 'FastEthernet0/1',
|
||||||
|
3 => 'FastEthernet0/2',
|
||||||
|
26 => 'FastEthernet2/1'
|
||||||
|
},
|
||||||
|
'c2900_p_index' => {'0.1' => 2, '0.2' => 3, '2.1' => 26},
|
||||||
|
'c2900_p_duplex' =>
|
||||||
|
{'0.1' => 'fullduplex', '0.2' => 'halfduplex', '2.1' => 'fullduplex'},
|
||||||
|
'c2900_p_duplex_admin' => {
|
||||||
|
'0.1' => 'autoNegotiate',
|
||||||
|
'0.2' => 'autoNegotiate',
|
||||||
|
'2.1' => 'fullduplex'
|
||||||
|
},
|
||||||
|
'c2900_p_speed_admin' =>
|
||||||
|
{'0.1' => 'autoDetect', '0.2' => 'autoDetect', '2.1' => 's100000000'},
|
||||||
|
'p_port' => {'0.1' => 2, '0.2' => 3, '2.1' => 26},
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'cisco', q(Vendor returns 'cisco'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cisco_comm_indexing : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok $test->{info}, 'cisco_comm_indexing';
|
||||||
|
is($test->{info}->cisco_comm_indexing(), 1, 'Cisco community indexing on');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_duplex : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_duplex');
|
||||||
|
|
||||||
|
my $expected = {2 => 'full', 3 => 'half', 26 => 'full'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_duplex(),
|
||||||
|
$expected, q(Interfaces have expected duplex values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_duplex(),
|
||||||
|
{}, q(No duplex data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_duplex_admin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_duplex_admin');
|
||||||
|
|
||||||
|
my $expected = {2 => 'auto', 3 => 'auto', 26 => 'full'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_duplex_admin(),
|
||||||
|
$expected, q(Interfaces have expected duplex admin values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_duplex_admin(),
|
||||||
|
{}, q(No duplex admin data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_speed_admin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_speed_admin');
|
||||||
|
|
||||||
|
my $expected = {2 => 'auto', 3 => 'auto', 26 => '100 Mbps'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_speed_admin(),
|
||||||
|
$expected, q(Interfaces have expected duplex admin values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_speed_admin(),
|
||||||
|
{}, q(No speed admin data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_i_speed_admin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'set_i_speed_admin');
|
||||||
|
|
||||||
|
is($test->{info}->set_i_speed_admin('100', 2),
|
||||||
|
1, q(Mock set speed call succeeded));
|
||||||
|
|
||||||
|
is($test->{info}->set_i_speed_admin('auto-x', 2),
|
||||||
|
undef, q(Mock set speed call to bad speed 'auto-x' fails));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub set_i_duplex_admin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'set_i_duplex_admin');
|
||||||
|
|
||||||
|
is($test->{info}->set_i_duplex_admin('full', 2),
|
||||||
|
1, q(Mock set duplex call succeeded));
|
||||||
|
|
||||||
|
is($test->{info}->set_i_duplex_admin('full-x', 2),
|
||||||
|
undef, q(Mock set duplex call to bad duplex type 'full-x' fails));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub interfaces : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'interfaces');
|
||||||
|
|
||||||
|
my $expected
|
||||||
|
= {2 => 'FastEthernet0/1', 3 => 'FastEthernet0/2', 26 => 'FastEthernet2/1'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->interfaces(),
|
||||||
|
$expected, q(Interfaces have expected values));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
152
xt/lib/Test/SNMP/Info/Layer2/Catalyst.pm
Normal file
152
xt/lib/Test/SNMP/Info/Layer2/Catalyst.pm
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Catalyst
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Catalyst;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Catalyst;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $d_string = 'Cisco Systems WS-C5500.Cisco ';
|
||||||
|
$d_string .= ' Catalyst Operating System Software, Version 5.5(13a).';
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => $d_string,
|
||||||
|
|
||||||
|
# CISCO-STACK-MIB::wsc5500sysID
|
||||||
|
'_id' => '.1.3.6.1.4.1.9.5.17',
|
||||||
|
'_m_swver' => 1,
|
||||||
|
'_i_index' => 1,
|
||||||
|
'_p_port' => 1,
|
||||||
|
'_p_oidx' => 1,
|
||||||
|
'_p_name' => 1,
|
||||||
|
'store' => {
|
||||||
|
'm_swver' => {1 => '5.5(13a)'},
|
||||||
|
'i_index' => {1 => 1, 3 => 3, 12 => 12},
|
||||||
|
'p_port' => {'1.1' => 3, '2.1' => 12},
|
||||||
|
'p_oidx' => {'1.1' => 1, '2.1' => 65},
|
||||||
|
'p_name' => {'1.1' => 'My Port Name 1.1', '2.1' => 'My Port Name 2.1'},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_physical : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_physical');
|
||||||
|
|
||||||
|
my $expected = {3 => 1, 12 => 1};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_physical(),
|
||||||
|
$expected, q(Physical interfaces are identified));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_physical(),
|
||||||
|
{}, q(No port data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'cisco', q(Vendor returns 'cisco'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'catalyst', q(Vendor returns 'catalyst'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os_ver : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os_ver');
|
||||||
|
is($test->{info}->os_ver(), '5.5(13a)', q(OS version is expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->os_ver(),
|
||||||
|
undef, q(No module sw version returns undef OS version));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub bp_index : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'bp_index');
|
||||||
|
|
||||||
|
my $expected = {1 => 3, 65 => 12};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->bp_index(),
|
||||||
|
$expected, q(Interfaces have expected name values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->bp_index(),
|
||||||
|
{}, q(No bridge index data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub cisco_comm_indexing : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok $test->{info}, 'cisco_comm_indexing';
|
||||||
|
is($test->{info}->cisco_comm_indexing(), 1, 'Cisco community indexing on');
|
||||||
|
}
|
||||||
|
|
||||||
|
sub interfaces : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'interfaces');
|
||||||
|
|
||||||
|
my $expected = {1 => 1, 3 => '1/1', 12 => '2/1'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->interfaces(),
|
||||||
|
$expected, q(Interfaces have expected values));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub i_name : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'i_name');
|
||||||
|
|
||||||
|
my $expected = {3 => 'My Port Name 1.1', 12 => 'My Port Name 2.1'};
|
||||||
|
|
||||||
|
cmp_deeply($test->{info}->i_name(),
|
||||||
|
$expected, q(Interfaces have expected name values));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
cmp_deeply($test->{info}->i_name(), {}, q(No name data returns empty hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
84
xt/lib/Test/SNMP/Info/Layer2/Centillion.pm
Normal file
84
xt/lib/Test/SNMP/Info/Layer2/Centillion.pm
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Centillion
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Centillion;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Centillion;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => 'My MCP ',
|
||||||
|
|
||||||
|
# CENTILLION-ROOT-MIB::cn5000BH-MCP
|
||||||
|
'_id' => '.1.3.6.1.4.1.930.1.4',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'centillion', q(Vendor returns 'centillion'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'nortel', q(Vendor returns 'nortel'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub model : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'model');
|
||||||
|
is($test->{info}->model(), '5000BH', q(Model is expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->model(), undef, q(No id returns undef model));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
51
xt/lib/Test/SNMP/Info/Layer2/Cisco.pm
Normal file
51
xt/lib/Test/SNMP/Info/Layer2/Cisco.pm
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Cisco
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Cisco;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Cisco;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# We need this to pass the device_type test inherited from My::Test::Class
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => undef,
|
||||||
|
|
||||||
|
# Cisco enterprise ID (9) to match generic fallback
|
||||||
|
'_id' => '.1.3.6.1.4.1.9',
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
73
xt/lib/Test/SNMP/Info/Layer2/CiscoSB.pm
Normal file
73
xt/lib/Test/SNMP/Info/Layer2/CiscoSB.pm
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::CiscoSB
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::CiscoSB;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::CiscoSB;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' =>
|
||||||
|
'Cisco SB',
|
||||||
|
'_id' => '.1.3.6.1.4.1.9.6.1',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'ros', q(Vendor returns 'ros'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'cisco', q(Vendor returns 'cisco'));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
73
xt/lib/Test/SNMP/Info/Layer2/HP.pm
Normal file
73
xt/lib/Test/SNMP/Info/Layer2/HP.pm
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::HP
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::HP;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::HP;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' =>
|
||||||
|
'HP J4887A ProCurve Switch 4104GL, revision G.05.02, ROM G.05.01',
|
||||||
|
'_id' => '.1.3.6.1.4.1.11.2.3.7.11.27',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'hp', q(Vendor returns 'hp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'hp', q(Vendor returns 'hp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
74
xt/lib/Test/SNMP/Info/Layer2/HP4000.pm
Normal file
74
xt/lib/Test/SNMP/Info/Layer2/HP4000.pm
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::HP4000
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::HP4000;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::HP4000;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' =>
|
||||||
|
'HP J4121A ProCurve Switch 4000M, revision C.09.16, ROM C.06.01',
|
||||||
|
# HP-ICF-OID::hpSwitch4000
|
||||||
|
'_id' => '.1.3.6.1.4.1.11.2.3.7.11.9',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'hp', q(Vendor returns 'hp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'hp', q(Vendor returns 'hp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
81
xt/lib/Test/SNMP/Info/Layer2/HPVC.pm
Normal file
81
xt/lib/Test/SNMP/Info/Layer2/HPVC.pm
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::HPVC
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::HPVC;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::HPVC;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 74,
|
||||||
|
'_description' => 'HP VC Flex-10/10D Module 4.50 2016-04-21T17:38:08Z',
|
||||||
|
|
||||||
|
# HPVC-MIB::hpModuleMgmtProc.4
|
||||||
|
'_id' => '.1.3.6.1.4.1.11.5.7.5.4',
|
||||||
|
'_productname' => 'BladeSystem c7000 Enclosure',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'hpvc', q(Vendor returns 'hpvc'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'hp', q(Vendor returns 'hp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub model : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'model');
|
||||||
|
is(
|
||||||
|
$test->{info}->model(),
|
||||||
|
'BladeSystem c7000 Enclosure',
|
||||||
|
q(Model has expected value)
|
||||||
|
);
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->model(), undef, q(No product name returns undef model));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
95
xt/lib/Test/SNMP/Info/Layer2/Kentrox.pm
Normal file
95
xt/lib/Test/SNMP/Info/Layer2/Kentrox.pm
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Kentrox
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Kentrox;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Kentrox;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => 'DataSMART 558 version 1.2',
|
||||||
|
'_id' => '.1.3.6.1.4.1.181.1.25',
|
||||||
|
'_ds_sysinfo' => 'SERIAL 01234567890',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'Kentrox', q(Vendor returns 'Kentrox'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os_ver : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os_ver');
|
||||||
|
is($test->{info}->os_ver(), '1.2', q(OS version has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->os_ver(), undef,
|
||||||
|
q(No description returns undef OS version));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub serial : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'serial');
|
||||||
|
is($test->{info}->serial(), '890', q(Serial has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->serial(), undef, q(No data returns undef serial));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'Kentrox', q(Vendor returns 'Kentrox'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub model : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'model');
|
||||||
|
is($test->{info}->model(), 'DataSMART 558', q(Model has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->model(), undef, q(No description returns undef model));
|
||||||
|
}
|
||||||
|
1;
|
||||||
90
xt/lib/Test/SNMP/Info/Layer2/N2270.pm
Normal file
90
xt/lib/Test/SNMP/Info/Layer2/N2270.pm
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::N2270
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::N2270;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::N2270;
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' => 'Nortel Networks WLAN - Security Switch',
|
||||||
|
|
||||||
|
# SYNOPTICS-ROOT-MIB::sreg-WLANSecuritySwitch2270
|
||||||
|
'_id' => '.1.3.6.1.4.1.45.3.60.1',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'nortel', q(OS has expected value));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'nortel', q(Vendor returns 'nortel'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub model : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'model');
|
||||||
|
is($test->{info}->model(), '2270', q(Model has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->model(), undef, q(No product name returns undef model));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub index_factor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'index_factor');
|
||||||
|
is($test->{info}->index_factor(), 256, q(Index factor returns 256));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub slot_offset : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'slot_offset');
|
||||||
|
is($test->{info}->slot_offset(), 0, q(Slot offset returns 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
90
xt/lib/Test/SNMP/Info/Layer2/NAP222x.pm
Normal file
90
xt/lib/Test/SNMP/Info/Layer2/NAP222x.pm
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::NAP222x
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::NAP222x;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::NAP222x;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' =>
|
||||||
|
'WLAN - Access Point 2220 HW:03 FW:1.1.6 SW:1.3.0.2 BN: NTAP:0.0 ',
|
||||||
|
|
||||||
|
# SYNOPTICS-ROOT-MIB::sreg-WLANAccessPoint2220-wirelessAP
|
||||||
|
'_id' => '.1.3.6.1.4.1.45.3.55.1',
|
||||||
|
'_nt_fw_ver' => 'v1.1.6',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'nortel', q(OS returns 'nortel'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os_bin : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os_bin');
|
||||||
|
|
||||||
|
is($test->{info}->os_bin(), '1.1.6', q(Firmware has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->os_bin(), undef, q(No data returns undef));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub model : Tests(3) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'model');
|
||||||
|
is($test->{info}->model(), 'AP-2220', q(Model has expected value));
|
||||||
|
|
||||||
|
$test->{info}->clear_cache();
|
||||||
|
is($test->{info}->model(), undef, q(No description returns undef model));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
78
xt/lib/Test/SNMP/Info/Layer2/Netgear.pm
Normal file
78
xt/lib/Test/SNMP/Info/Layer2/Netgear.pm
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Netgear
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Netgear;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Netgear;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 2,
|
||||||
|
'_description' =>
|
||||||
|
'My Bogus Netgear Description ',
|
||||||
|
|
||||||
|
# We don't have MIBs loaded to resolve so all we need is the right vendor
|
||||||
|
'_id' => '.1.3.6.1.4.1.4526',
|
||||||
|
'_ng_fsosver' => '',
|
||||||
|
'_ng_gsmserial' => '',
|
||||||
|
'_ng_gsmosver' => '',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub os : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'os');
|
||||||
|
is($test->{info}->os(), 'netgear', q(OS returns 'netgear'));
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is($test->{info}->vendor(), 'netgear', q(Vendor returns 'netgear'));
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
69
xt/lib/Test/SNMP/Info/Layer2/Ubiquiti.pm
Normal file
69
xt/lib/Test/SNMP/Info/Layer2/Ubiquiti.pm
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
# Test::SNMP::Info::Layer2::Ubiquiti
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Eric Miller
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of the University of California, Santa Cruz nor the
|
||||||
|
# names of its contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
package Test::SNMP::Info::Layer2::Ubiquiti;
|
||||||
|
|
||||||
|
use Test::Class::Most parent => 'My::Test::Class';
|
||||||
|
|
||||||
|
use SNMP::Info::Layer2::Ubiquiti;
|
||||||
|
|
||||||
|
# Remove this startup override once we have full method coverage
|
||||||
|
sub startup : Tests(startup => 1) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::startup();
|
||||||
|
|
||||||
|
$test->todo_methods(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup : Tests(setup) {
|
||||||
|
my $test = shift;
|
||||||
|
$test->SUPER::setup;
|
||||||
|
|
||||||
|
# Start with a common cache that will serve most tests
|
||||||
|
my $cache_data = {
|
||||||
|
'_layers' => 14,
|
||||||
|
'_description' => 'EdgeOS v4.3.16.4879270.160520.1505',
|
||||||
|
'_id' => '.1.3.6.1.4.1.41112.1.5',
|
||||||
|
'store' => {},
|
||||||
|
};
|
||||||
|
$test->{info}->cache($cache_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub vendor : Tests(2) {
|
||||||
|
my $test = shift;
|
||||||
|
|
||||||
|
can_ok($test->{info}, 'vendor');
|
||||||
|
is(
|
||||||
|
$test->{info}->vendor(),
|
||||||
|
'Ubiquiti Networks, Inc.',
|
||||||
|
q(Vendor returns 'Ubiquiti Networks, Inc.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
Reference in New Issue
Block a user