File Coverage

blib/lib/SNMP/Insight/MIB/Utils.pm
Criterion Covered Total %
statement 12 13 92.3
branch 2 4 50.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 19 22 86.3


line stmt bran cond sub pod time code
1             package SNMP::Insight::MIB::Utils;
2              
3             #ABSTRACT: Functions for dealing with MIB data
4              
5 3     3   12 use strict;
  3         3  
  3         94  
6 3     3   10 use warnings;
  3         3  
  3         94  
7              
8             our $VERSION = '0.002'; #TRIAL VERSION:
9              
10 3     3   10 use base qw( Exporter );
  3         8  
  3         724  
11             our @EXPORT_OK = qw( sysObjectID2vendor );
12              
13             my %ID_VENDOR_MAP = (
14             9 => 'Cisco',
15             11 => 'HP',
16             18 => 'BayRS',
17             42 => 'Sun',
18             43 => '3Com',
19             45 => 'Baystack',
20             171 => 'Dell',
21             207 => 'Allied',
22             244 => 'Lantronix',
23             311 => 'Microsoft',
24             318 => 'APC',
25             674 => 'Dell',
26             1872 => 'AlteonAD',
27             1916 => 'Extreme',
28             1991 => 'Foundry',
29             2021 => 'NetSNMP',
30             2272 => 'Passport',
31             2636 => 'Juniper',
32             2925 => 'Cyclades',
33             3076 => 'Altiga',
34             3224 => 'Netscreen',
35             3375 => 'F5',
36             3417 => 'BlueCoatSG',
37             4526 => 'Netgear',
38             5624 => 'Enterasys',
39             5951 => 'Netscaler',
40             6027 => 'Force10',
41             6486 => 'AlcatelLucent',
42             6527 => 'Timetra',
43             8072 => 'NetSNMP',
44             9303 => 'PacketFront',
45             10002 => 'Ubiquiti',
46             11898 => 'Orinoco',
47             12325 => 'Pf',
48             12356 => 'Fortinet',
49             12532 => 'Neoteris',
50             14179 => 'Airespace',
51             14525 => 'Trapeze',
52             14823 => 'Aruba',
53             14988 => 'Mikrotik',
54             17163 => 'Steelhead',
55             25506 => 'H3C',
56             26543 => 'IBMGbTor',
57             30065 => 'Arista',
58             35098 => 'Pica8',
59             );
60              
61             sub sysObjectID2vendor {
62 3     3 1 25 my ($id) = @_;
63 3 50       8 defined $id or return "NO VENDOR";
64              
65 3 50       121 $id =~ /^\.?1\.3\.6\.1\.4\.1\.(\d+)/ and return $ID_VENDOR_MAP{$1};
66 0           return "UNKNOWN";
67             }
68              
69             1;
70              
71             # Local Variables:
72             # mode: cperl
73             # indent-tabs-mode: nil
74             # cperl-indent-level: 4
75             # cperl-indent-parens-as-block: t
76             # End:
77              
78             __END__
79              
80             =pod
81              
82             =head1 NAME
83              
84             SNMP::Insight::MIB::Utils - Functions for dealing with MIB data
85              
86             =head1 VERSION
87              
88             version 0.002
89              
90             =head1 FUNCTIONS
91              
92             =head2 sysObjectID2vendor
93              
94             Try to extract a vendor string from a sysObjectID.
95              
96             =head1 AUTHOR
97              
98             Gabriele Mambrini <g.mambrini@gmail.com>
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             This software is copyright (c) 2015 by Gabriele Mambrini.
103              
104             This is free software; you can redistribute it and/or modify it under
105             the same terms as the Perl 5 programming language system itself.
106              
107             =cut