Info/Layer2/Exinda.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 51 CC 2 SCAR 10.3
CC
2
Cov
0%
mac
6.0
layers
2.0
vendor
2.0
CRAP 2.8
1 # SNMP::Info::Layer2::Exinda
2 #
3 # Copyright (c) 2018 nick nauwelaerts
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # * Redistributions of source code must retain the above copyright notice,
10 # this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # * Neither the name of the University of California, Santa Cruz nor the
15 # names of its contributors may be used to endorse or promote products
16 # derived from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 # POSSIBILITY OF SUCH DAMAGE.
29  
30 package SNMP::Info::Layer2::Exinda;
31  
32 use strict;
33 use warnings;
34  
35 use Exporter;
36 use SNMP::Info::Layer2;
37  
38 @SNMP::Info::Layer2::Exinda::ISA = qw/
39 SNMP::Info::Layer2
40 Exporter
41 /;
42 @SNMP::Info::Layer2::Exinda::EXPORT_OK = qw//;
43  
44 our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE);
45  
46 $VERSION = '3.985003';
47  
48 %MIBS = (
49 %SNMP::Info::Layer2::MIBS,
50 'EXINDA-MIB' => 'systemVersion',
51 );
52  
53 %GLOBALS = (
54 %SNMP::Info::Layer2::GLOBALS,
55 # EXINDA-MIB
56 'exinda_model' => 'hardwareSeries',
57 'serial1' => 'systemHostId',
58 'uptime' => 'systemUptime',
59 'os_ver' => 'systemVersion',
60 );
61  
62 %FUNCS = (
63 %SNMP::Info::Layer2::FUNCS,
64 );
65  
66 %MUNGE = (
67 %SNMP::Info::Layer2::MUNGE,
68 );
69  
70  
71 # layer 2: bridged shaping and failopen interfaces
72 # layer 3/4: ip and layer 4 protocol fiddling and accell
73 # layer 7: wccp support
74 sub layers {
75 return '01001110';
76 }
77  
78 sub vendor {
79 return 'exinda';
80 }
81  
82 # overwrite l2->model, hardwareSeries returns a plain string
83 sub model {
84 my $exinda = shift;
85 return $exinda->exinda_model;
86 }
87  
88 # systemHostId (and thus serial1) is actually also a mac address
89 sub mac {
90 my $exinda = shift;
91 my $exinda_mac = $exinda->serial1;
92  
93 return unless (defined $exinda_mac && (length $exinda_mac) == 12);
94 return join(":", $exinda_mac =~ m/\w{2}/g);
95 }
96  
97 sub os {
98 return 'exos';
99 }
100  
101 1;
102  
103 __END__