Info/Layer3/Netonix.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 57 CC 3 SCAR 12.4
CC
3
Cov
0%
model
6.0
serial
6.0
layers
2.0
CRAP 3.5
1 # SNMP::Info::Layer3::Netonix
2 #
3 # Copyright (c) 2014-2016 Max Kosmach
4 # Copyright (c) 2022 by Avant Wireless, LLC.
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are met:
9 #
10 # * Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # * Neither the name of the University of California, Santa Cruz nor the
16 # names of its contributors may be used to endorse or promote products
17 # derived from this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30  
31 package SNMP::Info::Layer3::Netonix;
32  
33 use strict;
34 use warnings;
35 use Exporter;
36 use SNMP::Info::Layer3;
37  
38 @SNMP::Info::Layer3::Netonix::ISA = qw/SNMP::Info::Layer3 Exporter/;
39 @SNMP::Info::Layer3::Netonix::EXPORT_OK = qw//;
40  
41 our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE);
42  
43 $VERSION = '3.985003';
44  
45 %MIBS = (
46 %SNMP::Info::Layer3::MIBS,
47 'NETONIX-SWITCH-MIB' => 'firmwareVersion',
48 );
49  
50 %GLOBALS = (
51 %SNMP::Info::Layer3::GLOBALS,
52 'os_ver' => 'firmwareVersion',
53 'mac' => 'dot1dBaseBridgeAddress.0',
54 );
55  
56 %FUNCS = (
57 %SNMP::Info::Layer3::FUNCS,
58 );
59  
60 %MUNGE = (
61 %SNMP::Info::Layer3::MUNGE,
62 );
63  
64 sub layers {
65 # layers 2 and 3
66 return '00000110';
67 }
68  
69 sub os {
70 my $netonix = shift;
71  
72 return 'netonix';
73 }
74  
75 sub vendor {
76 return 'netonix';
77 }
78  
79 sub model {
80 my $netonix = shift;
81  
82 my $descr = $netonix->description() || '';
83  
84 my $model = undef;
85 $model = $1 if ( $descr =~ /^Netonix\s+(\S+)$/i );
86 return $model;
87 }
88  
89 ## simply take the MAC and clean it up
90 sub serial {
91 my $netonix = shift;
92  
93 my $serial = $netonix->mac();
94 if($serial){
95 $serial =~ s/://g;
96 return uc $serial;
97 }
98 return ;
99 }
100  
101 1;
102 __END__