Info/Layer2/3Com.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 78 CC 5 SCAR 16.7
CC
5
Cov
0%
model
12.0
serial
6.0
os_ver
6.0
CRAP 5.3
1 # SNMP::Info::Layer2::3Com - SNMP Interface to 3Com Devices
2 #
3 # Copyright (c) 2019 by The Netdisco Developer Team.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
7 #
8 # * Redistributions of source code must retain the above copyright notice,
9 # this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # * Neither the name of the University of California, Santa Cruz nor the
14 # names of its contributors may be used to endorse or promote products
15 # derived from this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
28  
29 package SNMP::Info::Layer2::3Com;
30  
31 use strict;
32 use warnings;
33 use Exporter;
34 use SNMP::Info::Layer2;
35 use SNMP::Info::CDP;
36  
37 @SNMP::Info::Layer2::3Com::ISA = qw/SNMP::Info::Layer2 Exporter/;
38 @SNMP::Info::Layer2::3Com::EXPORT_OK = qw//;
39  
40 our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE, $AUTOLOAD);
41  
42 $VERSION = '3.985003';
43  
44 %MIBS = (
45 %SNMP::Info::Layer2::MIBS,
46 'A3Com-products-MIB' => 'wlanAP7760',
47 );
48  
49 %GLOBALS = (
50 %SNMP::Info::Layer2::GLOBALS,
51 );
52  
53 %FUNCS = (
54 %SNMP::Info::Layer2::FUNCS,
55 );
56  
57 %MUNGE = (
58 %SNMP::Info::Layer2::MUNGE,
59 );
60  
61 sub os {
62 return '3Com';
63 }
64  
65 sub serial {
66 my $dev = shift;
67 my $e_serial = $dev->e_serial();
68  
69 # Find entity table entry for this unit
70 foreach my $e ( sort keys %$e_serial ) {
71 if (defined $e_serial->{$e} and $e_serial->{$e} !~ /^\s*$/) {
72 return $e_serial->{$e};
73 }
74 }
75 return;
76 }
77  
78 sub os_ver {
79  
80 my $dev = shift;
81 my $e_swver = $dev->e_swver();
82 # Find entity table entry for this unit
83 foreach my $e ( sort keys %$e_swver ) {
84 if (defined $e_swver->{$e} and $e_swver->{$e} !~ /^\s*$/) {
85 return $e_swver->{$e};
86 }
87 }
88 return;
89 }
90  
91 sub vendor {
92 return '3com';
93 }
94  
95 sub model {
96 my $dsmodel = shift;
97 my $descr = $dsmodel->description();
98  
99 if (defined ($descr)) {
100 if ($descr =~ /^([\S ]+) Software.*/) {
101 return $1;
102 } else {
103 return $descr;
104 }
105 }
106 return;
107 }
108  
109 1;
110 __END__