IES/OID.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
↑ Summary IES.pm »
1 package Device::ZyXEL::IES::OID;
2  
3 0 ▶use SNMP;
Subroutine BEGIN: called CC=1 SCAR=2.6
4 use Capture::Tiny qw/capture/;
5  
6 =head1 NAME
7  
8 Device::ZyXEL::IES::OID - Translate names to OIDs for all the OID's used by Device::ZyXEL::IES::*
9  
10 =head1 VERSION
11  
12 Version 0.01
13  
14 =cut
15  
16 our $VERSION = '0.01';
17  
18 =head1 SYNOPSIS
19  
20 Just a method to translate a name to an OID.
21
22 my $n = Device::ZyXEL::IES::OID->new;
23  
24 my $oid = $n->translate("ZYXEL-IES5000-MIB::macFilterPortMacCount");
25
26 =cut
27  
28 # private map to use when MIB file lookup fails for any reason.
29 my %oid_map = (
30 'IF-MIB::ifOperStatus' => '.1.3.6.1.2.1.2.2.1.8',
31 'IF-MIB::ifAdminStatus' => '.1.3.6.1.2.1.2.2.1.7',
32 'IF-MIB::ifHCInOctets' => '.1.3.6.1.2.1.31.1.1.1.6',
33 'IF-MIB::ifHCOutOctets' => '.1.3.6.1.2.1.31.1.1.1.10',
34 'IF-MIB::ifLastChange' => '.1.3.6.1.2.1.2.2.1.9',
35  
36 'DISMAN-EVENT-MIB::sysUpTimeInstance' => '.1.3.6.1.2.1.1.3.0',
37 'SNMPv2-MIB::sysDescr.0' => '.1.3.6.1.2.1.1.1.0',
38  
39 'ADSL-LINE-MIB::adslLineConfProfile' => '.1.3.6.1.2.1.10.94.1.1.1.1.4',
40 'ADSL-LINE-MIB::adslAtucCurrAttainableRate' => '.1.3.6.1.2.1.10.94.1.1.2.1.8',
41 'ADSL-LINE-MIB::adslAturCurrAttainableRate' => '.1.3.6.1.2.1.10.94.1.1.3.1.8',
42 'ADSL-LINE-MIB::adslAtucChanCurrTxRate' => '.1.3.6.1.2.1.10.94.1.1.4.1.2',
43 'ADSL-LINE-MIB::adslAturChanCurrTxRate' => '.1.3.6.1.2.1.10.94.1.1.5.1.2',
44 'ADSL-LINE-MIB::adslAturCurrSnrMgn' => '.1.3.6.1.2.1.10.94.1.1.3.1.4',
45 'ADSL-LINE-MIB::adslAtucCurrSnrMgn' => '.1.3.6.1.2.1.10.94.1.1.2.1.4',
46 'ADSL-LINE-MIB::adslAturCurrAtn' => '.1.3.6.1.2.1.10.94.1.1.3.1.5',
47 'ADSL-LINE-MIB::adslAtucCurrAtn' => '.1.3.6.1.2.1.10.94.1.1.2.1.5',
48 'ADSL-LINE-MIB::adslAtucChanIntervalUncorrectBlks' => '.1.3.6.1.2.1.10.94.1.1.12.1.5',
49 'ADSL-LINE-MIB::adslAturChanIntervalUncorrectBlks' => '.1.3.6.1.2.1.10.94.1.1.13.1.5',
50 'ADSL-LINE-MIB::adslAtucIntervalESs' => '.1.3.6.1.2.1.10.94.1.1.8.1.6',
51 'ADSL-LINE-MIB::adslAturIntervalESs' => '.1.3.6.1.2.1.10.94.1.1.9.1.5',
52  
53 'VDSL-LINE-MIB::vdslLineConfProfile' => '.1.3.6.1.2.1.10.97.1.1.1.1.3',
54 'VDSL-LINE-MIB::vdslPhysCurrAttainableRate' => '.1.3.6.1.2.1.10.97.1.1.2.1.9',
55 'VDSL-LINE-MIB::vdslPhysCurrLineRate' => '.1.3.6.1.2.1.10.97.1.1.2.1.10',
56 'VDSL-LINE-MIB::vdslPhysCurrSnrMgn' => '.1.3.6.1.2.1.10.97.1.1.2.1.5',
57 'VDSL-LINE-MIB::vdslPhysCurrAtn' => '.1.3.6.1.2.1.10.97.1.1.2.1.6',
58 'VDSL-LINE-MIB::vdslChanIntervalBadBlks' => '.1.3.6.1.2.1.10.97.1.1.8.1.3', # <port>.1.x => Vtuc, <port>.2.x => Vtur
59 'VDSL-LINE-MIB::vdslPerfIntervalESs' => '.1.3.6.1.2.1.10.97.1.1.5.1.6', # <port>.1.x => Vtuc, <port>.2.x => Vtur
60  
61 'HDSL2-SHDSL-LINE-MIB::hdsl2ShdslSpanConfProfile' => '.1.3.6.1.2.1.10.48.1.1.1.2',
62 'HDSL2-SHDSL-LINE-MIB::hdsl2ShdslStatusActualLineRate' => '.1.3.6.1.2.1.10.48.1.2.1.3',
63 'HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn' => '.1.3.6.1.2.1.10.48.1.5.1.2',
64 'HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrAtn' => '.1.3.6.1.2.1.10.48.1.5.1.1',
65 'ZYXEL-IES5000-MIB::seltTarget.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.1.0',
66 'ZYXEL-IES5000-MIB::seltOps.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.2.0',
67 'ZYXEL-IES5000-MIB::seltStatus.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.3.0',
68 'ZYXEL-IES5000-MIB::seltCableType.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.4.0',
69 'ZYXEL-IES5000-MIB::seltLoopEstimateLengthFt.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.5.0',
70 'ZYXEL-IES5000-MIB::seltLoopEstimateLengthMeter.0' => '.1.3.6.1.4.1.890.1.5.13.5.4.3.6.0',
71 'ZYXEL-IES5000-MIB::macFilterPortMacCount' => '.1.3.6.1.4.1.890.1.5.13.5.1.3.1.1.2',
72 'ZYXEL-IES5000-MIB::dhcpDiscovery' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.2.1.1',
73 'ZYXEL-IES5000-MIB::dhcpOffer' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.2.1.2',
74 'ZYXEL-IES5000-MIB::dhcpRequest' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.2.1.3',
75 'ZYXEL-IES5000-MIB::dhcpAck' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.2.1.4',
76 'ZYXEL-IES5000-MIB::dhcpAckBySnoopFull' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.2.1.5',
77 'ZYXEL-IES5000-MIB::subrPortName' => '.1.3.6.1.4.1.890.1.5.13.5.8.1.1.1',
78 'ZYXEL-IES5000-MIB::slotModuleFWVersion.0' => '.1.3.6.1.4.1.890.1.5.13.5.6.3.1.4.0',
79 'ZYXEL-IES5000-MIB::slotModuleDescr.0' => '.1.3.6.1.4.1.890.1.5.13.5.6.3.1.3.0',
80 'ZYXEL-IES5000-MIB::dhcpSnoopMac' => '.1.3.6.1.4.1.890.1.5.13.5.13.1.1.1.2',
81  
82 'ZYXEL-IES5000-MIB::adslLineStatsAtucQln1' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.4',
83 'ZYXEL-IES5000-MIB::adslLineStatsAtucQln2' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.5',
84 'ZYXEL-IES5000-MIB::adslLineStatusUpTime' => '.1.3.6.1.4.1.890.1.5.13.5.8.2.4.1.2',
85 'ZYXEL-IES5000-MIB::adslLineConfAtucInp' => '.1.3.6.1.4.1.890.1.5.13.5.8.2.1.1.15',
86 'ZYXEL-IES5000-MIB::adslLineConfAturInp' => '.1.3.6.1.4.1.890.1.5.13.5.8.2.1.1.14',
87 'ZYXEL-IES5000-MIB::adslLineConfAnnexM' => '.1.3.6.1.4.1.890.1.5.13.5.8.2.1.1.3',
88 'ZYXEL-IES5000-MIB::adslLineConfAnnexL' => '.1.3.6.1.4.1.890.1.5.13.5.8.2.1.1.2',
89 'ZYXEL-IES5000-MIB::adslLineStatsAturHlog' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.3',
90 'ZYXEL-IES5000-MIB::adslLineStatsAtucHlog1' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.1',
91 'ZYXEL-IES5000-MIB::adslLineStatsAtucHlog2' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.2',
92 'ZYXEL-IES5000-MIB::adslLineStatsAturQln' => '.1.3.6.1.4.1.890.1.5.13.5.13.4.3.1.6',
93  
94 'ZYXEL-IES5000-MIB::vdslLineStatsVtucSnr' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.29',
95 'ZYXEL-IES5000-MIB::vdslLineStatsVtucSnrGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.40',
96 'ZYXEL-IES5000-MIB::vdslLineStatsVturSnr' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.30',
97 'ZYXEL-IES5000-MIB::vdslLineStatsVturSnrGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.41',
98 'ZYXEL-IES5000-MIB::vdslLineConfVturInp' => '.1.3.6.1.4.1.890.1.5.13.5.8.10.1.1.6',
99 'ZYXEL-IES5000-MIB::vdslLineConfVtucInp' => '.1.3.6.1.4.1.890.1.5.13.5.8.10.1.1.7',
100 'ZYXEL-IES5000-MIB::vdslLineStatsProtocol' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.33',
101 'ZYXEL-IES5000-MIB::vdslLineStatsVturHlog' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.26',
102 'ZYXEL-IES5000-MIB::vdslLineStatsVturHlogGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.37',
103 'ZYXEL-IES5000-MIB::vdslLineStatsVtucHlog' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.25',
104 'ZYXEL-IES5000-MIB::vdslLineStatsVtucHlogGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.36',
105 'ZYXEL-IES5000-MIB::vdslLineStatsVturQln' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.28',
106 'ZYXEL-IES5000-MIB::vdslLineStatsVturQlnGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.39',
107 'ZYXEL-IES5000-MIB::vdslLineStatsVtucQln' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.27',
108 'ZYXEL-IES5000-MIB::vdslLineStatsVtucQlnGroupSize' => '.1.3.6.1.4.1.890.1.5.13.5.13.8.2.1.38',
109  
110 'ZYXEL-IES5000-MIB::shdslLineStatusWirePair' => '.1.3.6.1.4.1.890.1.5.13.5.8.3.3.1.1',
111 );
112  
113 # assume mibs are installed and loaded.
114 our $mib_loaded = 1;
115  
116 =head2 new
117
118 Just calls SNMP::initMib() to read the mib files of the system.
119  
120 =cut
121 sub new {
122 my $class = shift;
123 SNMP::initMib();
124 return bless {}, $class;
125 }
126  
127  
128 sub translate {
129 my ($self,$name,$postfix) = @_;
130 my $oid;
131 if ( $mib_loaded ) {
132 my ($stdout,$stderr) = capture {
133 $oid = SNMP::translateObj($name);
134 };
135 $mib_loaded = 0 if $stderr ne '';
136 }
137 if ( !defined( $oid ) && defined( $oid_map{$name} ) ) {
138 $oid = $oid_map{$name};
139 }
140 if ( defined( $oid ) && defined( $postfix ) && $postfix ne '' ) {
141 $oid = $oid . '.' . $postfix;
142 }
143 return $oid;
144 }
145  
146 =head1 SUPPORT
147  
148 You can find documentation for this module with the perldoc command.
149  
150 perldoc Device::ZyXEL::IES::OID
151  
152 You can also look for information at:
153  
154 =over 4
155  
156 =item * RT: CPAN's request tracker
157  
158 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Device-ZyXEL-IES>
159  
160 =item * AnnoCPAN: Annotated CPAN documentation
161  
162 L<http://annocpan.org/dist/Device-ZyXEL-IES>
163  
164 =item * CPAN Ratings
165  
166 L<http://cpanratings.perl.org/d/Device-ZyXEL-IES>
167  
168 =item * Search CPAN
169  
170 L<http://search.cpan.org/dist/Device-ZyXEL-IES/>
171  
172 =back
173  
174  
175 =head1 ACKNOWLEDGEMENTS
176  
177 Fullrate (http://www.fullrate.dk)
178  
179 Thanks for allowing me to be introduced to the "wonderful" device ;)
180 And thanks for donating some of my work time to create this module and
181 sharing it with the world.
182
183 =head1 COPYRIGHT & LICENSE
184
185 Copyright 2012 Jesper Dalberg, all rights reserved.
186
187 This program is free software; you can redistribute it and/or modify it
188 under the same terms as Perl itself.
189  
190 =cut
191  
192 1;
↑ Summary IES.pm »