| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ============================================================================= |
|
2
|
|
|
|
|
|
|
package Net::SNMP::Util::TC; |
|
3
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
4
|
|
|
|
|
|
|
$Net::SNMP::Util::TC::VERSION = '1.04'; |
|
5
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
6
|
2
|
|
|
2
|
|
43458
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
67
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
81
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::SNMP::Util::TC - Giving Textual Convention of MIBs |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::SNMP::Util; |
|
16
|
|
|
|
|
|
|
use Net::SNMP::Util::OID qw(if*); |
|
17
|
|
|
|
|
|
|
use Net::SNMP::Util::TC qw(updown iftype); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$r = snmpget( |
|
20
|
|
|
|
|
|
|
snmp => { -hostname => $host }, |
|
21
|
|
|
|
|
|
|
oids => { map oidp("$_.1"), qw/ifName ifType ifAdminStatus ifOperStatus/ } |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
my $tc = Net::SNMP::Util::TC->new(); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
printf "port:%s index:%d type:%s astat:%s ostat:%s\n", |
|
26
|
|
|
|
|
|
|
$r->{"ifName.1"}, $index, $tc->ifType($r->{"ifType.1"}), |
|
27
|
|
|
|
|
|
|
updown($r->{"ifAdminStatus.1"}), |
|
28
|
|
|
|
|
|
|
updown($r->{"ifOperStatus.1" }); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Module C gives the way to convert some MIB values to |
|
34
|
|
|
|
|
|
|
humans recognizable text. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 EXPORT |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This module, C, exports C and C |
|
39
|
|
|
|
|
|
|
defalut which are for ifAdminStatus and ifOperStatus to check up or down |
|
40
|
|
|
|
|
|
|
simply. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
To know status, kind or type fully, make object first and than call method |
|
43
|
|
|
|
|
|
|
with MIB value to convert like below; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$tc = Net::SNMP::Util::TC->new(); |
|
46
|
|
|
|
|
|
|
$status = $tc->ifAdminStatus($value); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
|
50
|
|
|
|
|
|
|
|
|
51
|
2
|
|
|
2
|
|
9
|
use Carp qw(); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
32
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
2
|
|
|
2
|
|
9
|
use constant DEBUG => 0; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
181
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
2
|
|
|
2
|
|
12
|
use base qw( Exporter ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
2142
|
|
|
56
|
|
|
|
|
|
|
our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION); |
|
57
|
|
|
|
|
|
|
@EXPORT = qw( isup updown ); |
|
58
|
|
|
|
|
|
|
@EXPORT_OK = qw( updown ifadminstatus ifoperstatus iftype ifrcvaddresstype ); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# ============================================================================= |
|
62
|
|
|
|
|
|
|
my %_TC_base = ( |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
'ifAdminStatus' => { |
|
65
|
|
|
|
|
|
|
1 => "up", # ready to pass packets |
|
66
|
|
|
|
|
|
|
2 => "down", |
|
67
|
|
|
|
|
|
|
3 => "testing", # in some test mode |
|
68
|
|
|
|
|
|
|
}, |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
'ifOperStatus' => { |
|
71
|
|
|
|
|
|
|
1 => "up", # ready to pass packets |
|
72
|
|
|
|
|
|
|
2 => "down", |
|
73
|
|
|
|
|
|
|
3 => "testing", # in some test mode |
|
74
|
|
|
|
|
|
|
4 => "unknown", # status can not be determined |
|
75
|
|
|
|
|
|
|
# for some reason. |
|
76
|
|
|
|
|
|
|
5 => "dormant", |
|
77
|
|
|
|
|
|
|
6 => "notPresent", # some component is missing |
|
78
|
|
|
|
|
|
|
7 => "lowerLayerDown", # down due to state of |
|
79
|
|
|
|
|
|
|
# lower-layer interface(s) |
|
80
|
|
|
|
|
|
|
}, |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# IANAifType ( http://www.iana.org/assignments/ianaiftype-mib ) |
|
83
|
|
|
|
|
|
|
# version : "201009210000Z" -- September 21, 2010 |
|
84
|
|
|
|
|
|
|
'ifType' => { |
|
85
|
|
|
|
|
|
|
1 => "other", # none of the following |
|
86
|
|
|
|
|
|
|
2 => "regular1822", |
|
87
|
|
|
|
|
|
|
3 => "hdh1822", |
|
88
|
|
|
|
|
|
|
4 => "ddn-x25", |
|
89
|
|
|
|
|
|
|
5 => "rfc877-x25", |
|
90
|
|
|
|
|
|
|
6 => "ethernet-csmacd", # for all ethernet-like interfaces, |
|
91
|
|
|
|
|
|
|
# regardless of speed, as per RFC3635 |
|
92
|
|
|
|
|
|
|
7 => "iso88023-csmacd", # Deprecated via RFC3635 |
|
93
|
|
|
|
|
|
|
# ethernetCsmacd (6) should be used instead |
|
94
|
|
|
|
|
|
|
8 => "iso88024-tokenBus", |
|
95
|
|
|
|
|
|
|
9 => "iso88025-tokenRing", |
|
96
|
|
|
|
|
|
|
10 => "iso88026-man", |
|
97
|
|
|
|
|
|
|
11 => "starLan", # Deprecated via RFC3635 |
|
98
|
|
|
|
|
|
|
# ethernetCsmacd(6) should be used instead |
|
99
|
|
|
|
|
|
|
12 => "proteon-10Mbit", |
|
100
|
|
|
|
|
|
|
13 => "proteon-80Mbit", |
|
101
|
|
|
|
|
|
|
14 => "hyperchannel", |
|
102
|
|
|
|
|
|
|
15 => "fddi", |
|
103
|
|
|
|
|
|
|
16 => "lapb", |
|
104
|
|
|
|
|
|
|
17 => "sdlc", |
|
105
|
|
|
|
|
|
|
18 => "ds1", # DS1-MIB |
|
106
|
|
|
|
|
|
|
19 => "e1", # Obsolete see DS1-MIB |
|
107
|
|
|
|
|
|
|
20 => "basicISDN", # no longer used. see also RFC2127 |
|
108
|
|
|
|
|
|
|
21 => "primaryISDN", # no longer used. see also RFC2127 |
|
109
|
|
|
|
|
|
|
22 => "propPointToPointSerial", # proprietary serial |
|
110
|
|
|
|
|
|
|
23 => "ppp", |
|
111
|
|
|
|
|
|
|
24 => "softwareLoopback", |
|
112
|
|
|
|
|
|
|
25 => "eon", # CLNP over IP |
|
113
|
|
|
|
|
|
|
26 => "ethernet-3Mbit", |
|
114
|
|
|
|
|
|
|
27 => "nsip", # XNS over IP |
|
115
|
|
|
|
|
|
|
28 => "slip", # generic SLIP |
|
116
|
|
|
|
|
|
|
29 => "ultra", # ULTRA technologies |
|
117
|
|
|
|
|
|
|
30 => "ds3", # DS3-MIB |
|
118
|
|
|
|
|
|
|
31 => "sip", # SMDS, coffee |
|
119
|
|
|
|
|
|
|
32 => "frame-relay", # DTE only. |
|
120
|
|
|
|
|
|
|
33 => "rs232", |
|
121
|
|
|
|
|
|
|
34 => "para", # parallel-port |
|
122
|
|
|
|
|
|
|
35 => "arcnet", # arcnet |
|
123
|
|
|
|
|
|
|
36 => "arcnetPlus", # arcnet plus |
|
124
|
|
|
|
|
|
|
37 => "atm", # ATM cells |
|
125
|
|
|
|
|
|
|
38 => "miox25", |
|
126
|
|
|
|
|
|
|
39 => "sonet", # SONET or SDH |
|
127
|
|
|
|
|
|
|
40 => "x25ple", |
|
128
|
|
|
|
|
|
|
41 => "iso88022llc", |
|
129
|
|
|
|
|
|
|
42 => "localTalk", |
|
130
|
|
|
|
|
|
|
43 => "smdsDxi", |
|
131
|
|
|
|
|
|
|
44 => "frameRelayService", # FRNETSERV-MIB |
|
132
|
|
|
|
|
|
|
45 => "v35", |
|
133
|
|
|
|
|
|
|
46 => "hssi", |
|
134
|
|
|
|
|
|
|
47 => "hippi", |
|
135
|
|
|
|
|
|
|
48 => "modem", # Generic modem |
|
136
|
|
|
|
|
|
|
49 => "aal5", # AAL5 over ATM |
|
137
|
|
|
|
|
|
|
50 => "sonetPath", |
|
138
|
|
|
|
|
|
|
51 => "sonetVT", |
|
139
|
|
|
|
|
|
|
52 => "smdsIcip", # SMDS InterCarrier Interface |
|
140
|
|
|
|
|
|
|
53 => "propVirtual", # proprietary virtual/internal |
|
141
|
|
|
|
|
|
|
54 => "propMultiplexor", # proprietary multiplexing |
|
142
|
|
|
|
|
|
|
55 => "ieee80212", # 100BaseVG |
|
143
|
|
|
|
|
|
|
56 => "fibreChannel", # Fibre Channel |
|
144
|
|
|
|
|
|
|
57 => "hippiInterface", # HIPPI interfaces |
|
145
|
|
|
|
|
|
|
58 => "frameRelayInterconnect", # Obsolete |
|
146
|
|
|
|
|
|
|
# use either frameRelay(32) or frameRelayService(44) |
|
147
|
|
|
|
|
|
|
59 => "aflane8023", # ATM Emulated LAN for 802.3 |
|
148
|
|
|
|
|
|
|
60 => "aflane8025", # ATM Emulated LAN for 802.5 |
|
149
|
|
|
|
|
|
|
61 => "cctEmul", # ATM Emulated circuit |
|
150
|
|
|
|
|
|
|
62 => "fastEther", # Obsoleted via RFC3635 |
|
151
|
|
|
|
|
|
|
# ethernetCsmacd(6) should be used instead |
|
152
|
|
|
|
|
|
|
63 => "isdn", # ISDN and X.25 |
|
153
|
|
|
|
|
|
|
64 => "v11", # CCITT V.11/X.21 |
|
154
|
|
|
|
|
|
|
65 => "v36", # CCITT V.36 |
|
155
|
|
|
|
|
|
|
66 => "g703at64k", # CCITT G703 at 64Kbps |
|
156
|
|
|
|
|
|
|
67 => "g703at2mb", # Obsolete see DS1-MIB |
|
157
|
|
|
|
|
|
|
68 => "qllc", # SNA QLLC |
|
158
|
|
|
|
|
|
|
69 => "fastEtherFX", # Obsoleted via RFC3635 |
|
159
|
|
|
|
|
|
|
# ethernetCsmacd(6) should be used instead |
|
160
|
|
|
|
|
|
|
70 => "channel", # channel |
|
161
|
|
|
|
|
|
|
71 => "ieee80211", # radio spread spectrum |
|
162
|
|
|
|
|
|
|
72 => "ibm370parChan", # IBM System 360/370 OEMI Channel |
|
163
|
|
|
|
|
|
|
73 => "escon", # IBM Enterprise Systems Connection |
|
164
|
|
|
|
|
|
|
74 => "dlsw", # Data Link Switching |
|
165
|
|
|
|
|
|
|
75 => "isdns", # ISDN S/T interface |
|
166
|
|
|
|
|
|
|
76 => "isdnu", # ISDN U interface |
|
167
|
|
|
|
|
|
|
77 => "lapd", # Link Access Protocol D |
|
168
|
|
|
|
|
|
|
78 => "ipSwitch", # IP Switching Objects |
|
169
|
|
|
|
|
|
|
79 => "rsrb", # Remote Source Route Bridging |
|
170
|
|
|
|
|
|
|
80 => "atmLogical", # ATM Logical Port |
|
171
|
|
|
|
|
|
|
81 => "ds0", # Digital Signal Level 0 |
|
172
|
|
|
|
|
|
|
82 => "ds0Bundle", # group of ds0s on the same ds1 |
|
173
|
|
|
|
|
|
|
83 => "bsc", # Bisynchronous Protocol |
|
174
|
|
|
|
|
|
|
84 => "async", # Asynchronous Protocol |
|
175
|
|
|
|
|
|
|
85 => "cnr", # Combat Net Radio |
|
176
|
|
|
|
|
|
|
86 => "iso88025Dtr", # ISO 802.5r DTR |
|
177
|
|
|
|
|
|
|
87 => "eplrs", # Ext Pos Loc Report Sys |
|
178
|
|
|
|
|
|
|
88 => "arap", # Appletalk Remote Access Protocol |
|
179
|
|
|
|
|
|
|
89 => "propCnls", # Proprietary Connectionless Protocol |
|
180
|
|
|
|
|
|
|
90 => "hostPad", # CCITT-ITU X.29 PAD Protocol |
|
181
|
|
|
|
|
|
|
91 => "termPad", # CCITT-ITU X.3 PAD Facility |
|
182
|
|
|
|
|
|
|
92 => "frameRelayMPI", # Multiproto Interconnect over FR |
|
183
|
|
|
|
|
|
|
93 => "x213", # CCITT-ITU X213 |
|
184
|
|
|
|
|
|
|
94 => "adsl", # Asymmetric Digital Subscriber Loop |
|
185
|
|
|
|
|
|
|
95 => "radsl", # Rate-Adapt. Digital Subscriber Loop |
|
186
|
|
|
|
|
|
|
96 => "sdsl", # Symmetric Digital Subscriber Loop |
|
187
|
|
|
|
|
|
|
97 => "vdsl", # Very H-Speed Digital Subscrib. Loop |
|
188
|
|
|
|
|
|
|
98 => "iso88025CRFPInt", # ISO 802.5 CRFP |
|
189
|
|
|
|
|
|
|
99 => "myrinet", # Myricom Myrinet |
|
190
|
|
|
|
|
|
|
100 => "voiceEM", # voice recEive and transMit |
|
191
|
|
|
|
|
|
|
101 => "voiceFXO", # voice Foreign Exchange Office |
|
192
|
|
|
|
|
|
|
102 => "voiceFXS", # voice Foreign Exchange Station |
|
193
|
|
|
|
|
|
|
103 => "voiceEncap", # voice encapsulation |
|
194
|
|
|
|
|
|
|
104 => "voiceOverIp", # voice over IP encapsulation |
|
195
|
|
|
|
|
|
|
105 => "atmDxi", # ATM DXI |
|
196
|
|
|
|
|
|
|
106 => "atmFuni", # ATM FUNI |
|
197
|
|
|
|
|
|
|
107 => "atmIma", # ATM IMA |
|
198
|
|
|
|
|
|
|
108 => "pppMultilinkBundle", # PPP Multilink Bundle |
|
199
|
|
|
|
|
|
|
109 => "ipOverCdlc", # IBM ipOverCdlc |
|
200
|
|
|
|
|
|
|
110 => "ipOverClaw", # IBM Common Link Access to Workstn |
|
201
|
|
|
|
|
|
|
111 => "stackToStack", # IBM stackToStack |
|
202
|
|
|
|
|
|
|
112 => "virtualIpAddress", # IBM VIPA |
|
203
|
|
|
|
|
|
|
113 => "mpc", # IBM multi-protocol channel support |
|
204
|
|
|
|
|
|
|
114 => "ipOverAtm", # IBM ipOverAtm |
|
205
|
|
|
|
|
|
|
115 => "iso88025Fiber", # ISO 802.5j Fiber Token Ring |
|
206
|
|
|
|
|
|
|
116 => "tdlc", # IBM twinaxial data link control |
|
207
|
|
|
|
|
|
|
117 => "gigabitEthernet", # Obsoleted via RFC3635 |
|
208
|
|
|
|
|
|
|
# ethernetCsmacd(6) should be used instead |
|
209
|
|
|
|
|
|
|
118 => "hdlc", # HDLC |
|
210
|
|
|
|
|
|
|
119 => "lapf", # LAP F |
|
211
|
|
|
|
|
|
|
120 => "v37", # V.37 |
|
212
|
|
|
|
|
|
|
121 => "x25mlp", # Multi-Link Protocol |
|
213
|
|
|
|
|
|
|
122 => "x25huntGroup", # X25 Hunt Group |
|
214
|
|
|
|
|
|
|
123 => "transpHdlc", # Transp HDLC |
|
215
|
|
|
|
|
|
|
124 => "interleave", # Interleave channel |
|
216
|
|
|
|
|
|
|
125 => "fast", # Fast channel |
|
217
|
|
|
|
|
|
|
126 => "ip", # IP (for APPN HPR in IP networks) |
|
218
|
|
|
|
|
|
|
127 => "docsCableMaclayer", # CATV Mac Layer |
|
219
|
|
|
|
|
|
|
128 => "docsCableDownstream", # CATV Downstream interface |
|
220
|
|
|
|
|
|
|
129 => "docsCableUpstream", # CATV Upstream interface |
|
221
|
|
|
|
|
|
|
130 => "a12MppSwitch", # Avalon Parallel Processor |
|
222
|
|
|
|
|
|
|
131 => "tunnel", # Encapsulation interface |
|
223
|
|
|
|
|
|
|
132 => "coffee", # coffee pot |
|
224
|
|
|
|
|
|
|
133 => "ces", # Circuit Emulation Service |
|
225
|
|
|
|
|
|
|
134 => "atmSubInterface", # ATM Sub Interface |
|
226
|
|
|
|
|
|
|
135 => "l2vlan", # Layer 2 Virtual LAN using 802.1Q |
|
227
|
|
|
|
|
|
|
136 => "l3ipvlan", # Layer 3 Virtual LAN using IP |
|
228
|
|
|
|
|
|
|
137 => "l3ipxvlan", # Layer 3 Virtual LAN using IPX |
|
229
|
|
|
|
|
|
|
138 => "digitalPowerline", # IP over Power Lines |
|
230
|
|
|
|
|
|
|
139 => "mediaMailOverIp", # Multimedia Mail over IP |
|
231
|
|
|
|
|
|
|
140 => "dtm", # Dynamic syncronous Transfer Mode |
|
232
|
|
|
|
|
|
|
141 => "dcn", # Data Communications Network |
|
233
|
|
|
|
|
|
|
142 => "ipForward", # IP Forwarding Interface |
|
234
|
|
|
|
|
|
|
143 => "msdsl", # Multi-rate Symmetric DSL |
|
235
|
|
|
|
|
|
|
144 => "ieee1394", # IEEE1394 High Performance Serial Bus |
|
236
|
|
|
|
|
|
|
145 => "if-gsn", # HIPPI-6400 |
|
237
|
|
|
|
|
|
|
146 => "dvbRccMacLayer", # DVB-RCC MAC Layer |
|
238
|
|
|
|
|
|
|
147 => "dvbRccDownstream", # DVB-RCC Downstream Channel |
|
239
|
|
|
|
|
|
|
148 => "dvbRccUpstream", # DVB-RCC Upstream Channel |
|
240
|
|
|
|
|
|
|
149 => "atmVirtual", # ATM Virtual Interface |
|
241
|
|
|
|
|
|
|
150 => "mplsTunnel", # MPLS Tunnel Virtual Interface |
|
242
|
|
|
|
|
|
|
151 => "srp", # Spatial Reuse Protocol |
|
243
|
|
|
|
|
|
|
152 => "voiceOverAtm", # Voice Over ATM |
|
244
|
|
|
|
|
|
|
153 => "voiceOverFrameRelay", # Voice Over Frame Relay |
|
245
|
|
|
|
|
|
|
154 => "idsl", # Digital Subscriber Loop over ISDN |
|
246
|
|
|
|
|
|
|
155 => "compositeLink", # Avici Composite Link Interface |
|
247
|
|
|
|
|
|
|
156 => "ss7SigLink", # SS7 Signaling Link |
|
248
|
|
|
|
|
|
|
157 => "propWirelessP2P", # Prop. P2P wireless interface |
|
249
|
|
|
|
|
|
|
158 => "frForward", # Frame Forward Interface |
|
250
|
|
|
|
|
|
|
159 => "rfc1483", # Multiprotocol over ATM AAL5 |
|
251
|
|
|
|
|
|
|
160 => "usb", # USB Interface |
|
252
|
|
|
|
|
|
|
161 => "ieee8023adLag", # IEEE 802.3ad Link Aggregate |
|
253
|
|
|
|
|
|
|
162 => "bgppolicyaccounting", # BGP Policy Accounting |
|
254
|
|
|
|
|
|
|
163 => "frf16MfrBundle", # FRF .16 Multilink Frame Relay |
|
255
|
|
|
|
|
|
|
164 => "h323Gatekeeper", # H323 Gatekeeper |
|
256
|
|
|
|
|
|
|
165 => "h323Proxy", # H323 Voice and Video Proxy |
|
257
|
|
|
|
|
|
|
166 => "mpls", # MPLS |
|
258
|
|
|
|
|
|
|
167 => "mfSigLink", # Multi-frequency signaling link |
|
259
|
|
|
|
|
|
|
168 => "hdsl2", # High Bit-Rate DSL - 2nd generation |
|
260
|
|
|
|
|
|
|
169 => "shdsl", # Multirate HDSL2 |
|
261
|
|
|
|
|
|
|
170 => "ds1FDL", # Facility Data Link 4Kbps on a DS1 |
|
262
|
|
|
|
|
|
|
171 => "pos", # Packet over SONET/SDH Interface |
|
263
|
|
|
|
|
|
|
172 => "dvbAsiIn", # DVB-ASI Input |
|
264
|
|
|
|
|
|
|
173 => "dvbAsiOut", # DVB-ASI Output |
|
265
|
|
|
|
|
|
|
174 => "plc", # Power Line Communtications |
|
266
|
|
|
|
|
|
|
175 => "nfas", # Non Facility Associated Signaling |
|
267
|
|
|
|
|
|
|
176 => "tr008", # TR008 |
|
268
|
|
|
|
|
|
|
177 => "gr303RDT", # Remote Digital Terminal |
|
269
|
|
|
|
|
|
|
178 => "gr303IDT", # Integrated Digital Terminal |
|
270
|
|
|
|
|
|
|
179 => "isup", # ISUP |
|
271
|
|
|
|
|
|
|
180 => "propDocsWirelessMaclayer", # Cisco proprietary Maclayer |
|
272
|
|
|
|
|
|
|
181 => "propDocsWirelessDownstream", # Cisco proprietary Downstream |
|
273
|
|
|
|
|
|
|
182 => "propDocsWirelessUpstream", # Cisco proprietary Upstream |
|
274
|
|
|
|
|
|
|
183 => "hiperlan2", # HIPERLAN Type 2 Radio Interface |
|
275
|
|
|
|
|
|
|
184 => "propBWAp2Mp", # PropBroadbandWirelessAccesspt2multipt |
|
276
|
|
|
|
|
|
|
# use of this iftype for IEEE 802.16 WMAN |
|
277
|
|
|
|
|
|
|
# interfaces as per IEEE Std 802.16f is |
|
278
|
|
|
|
|
|
|
# deprecated and ifType 237 should be used instead. |
|
279
|
|
|
|
|
|
|
185 => "sonetOverheadChannel", # SONET Overhead Channel |
|
280
|
|
|
|
|
|
|
186 => "digitalWrapperOverheadChannel", # Digital Wrapper |
|
281
|
|
|
|
|
|
|
187 => "aal2", # ATM adaptation layer 2 |
|
282
|
|
|
|
|
|
|
188 => "radioMAC", # MAC layer over radio links |
|
283
|
|
|
|
|
|
|
189 => "atmRadio", # ATM over radio links |
|
284
|
|
|
|
|
|
|
190 => "imt", # Inter Machine Trunks |
|
285
|
|
|
|
|
|
|
191 => "mvl", # Multiple Virtual Lines DSL |
|
286
|
|
|
|
|
|
|
192 => "reachDSL", # Long Reach DSL |
|
287
|
|
|
|
|
|
|
193 => "frDlciEndPt", # Frame Relay DLCI End Point |
|
288
|
|
|
|
|
|
|
194 => "atmVciEndPt", # ATM VCI End Point |
|
289
|
|
|
|
|
|
|
195 => "opticalChannel", # Optical Channel |
|
290
|
|
|
|
|
|
|
196 => "opticalTransport", # Optical Transport |
|
291
|
|
|
|
|
|
|
197 => "propAtm", # Proprietary ATM |
|
292
|
|
|
|
|
|
|
198 => "voiceOverCable", # Voice Over Cable Interface |
|
293
|
|
|
|
|
|
|
199 => "infiniband", # Infiniband |
|
294
|
|
|
|
|
|
|
200 => "teLink", # TE Link |
|
295
|
|
|
|
|
|
|
201 => "q2931", # Q.2931 |
|
296
|
|
|
|
|
|
|
202 => "virtualTg", # Virtual Trunk Group |
|
297
|
|
|
|
|
|
|
203 => "sipTg", # SIP Trunk Group |
|
298
|
|
|
|
|
|
|
204 => "sipSig", # SIP Signaling |
|
299
|
|
|
|
|
|
|
205 => "docsCableUpstreamChannel", # CATV Upstream Channel |
|
300
|
|
|
|
|
|
|
206 => "econet", # Acorn Econet |
|
301
|
|
|
|
|
|
|
207 => "pon155", # FSAN 155Mb Symetrical PON interface |
|
302
|
|
|
|
|
|
|
208 => "pon622", # FSAN622Mb Symetrical PON interface |
|
303
|
|
|
|
|
|
|
209 => "bridge", # Transparent bridge interface |
|
304
|
|
|
|
|
|
|
210 => "linegroup", # Interface common to multiple lines |
|
305
|
|
|
|
|
|
|
211 => "voiceEMFGD", # voice E&M Feature Group D |
|
306
|
|
|
|
|
|
|
212 => "voiceFGDEANA", # voice FGD Exchange Access North American |
|
307
|
|
|
|
|
|
|
213 => "voiceDID", # voice Direct Inward Dialing |
|
308
|
|
|
|
|
|
|
214 => "mpegTransport", # MPEG transport interface |
|
309
|
|
|
|
|
|
|
215 => "sixToFour", # 6to4 interface (DEPRECATED) |
|
310
|
|
|
|
|
|
|
216 => "gtp", # GTP (GPRS Tunneling Protocol) |
|
311
|
|
|
|
|
|
|
217 => "pdnEtherLoop1", # Paradyne EtherLoop 1 |
|
312
|
|
|
|
|
|
|
218 => "pdnEtherLoop2", # Paradyne EtherLoop 2 |
|
313
|
|
|
|
|
|
|
219 => "opticalChannelGroup", # Optical Channel Group |
|
314
|
|
|
|
|
|
|
220 => "homepna", # HomePNA ITU-T G.989 |
|
315
|
|
|
|
|
|
|
221 => "gfp", # Generic Framing Procedure (GFP) |
|
316
|
|
|
|
|
|
|
222 => "ciscoISLvlan", # Layer 2 Virtual LAN using Cisco ISL |
|
317
|
|
|
|
|
|
|
223 => "actelisMetaLOOP", # Acteleis proprietary MetaLOOP High Speed Link |
|
318
|
|
|
|
|
|
|
224 => "fcipLink", # FCIP Link |
|
319
|
|
|
|
|
|
|
225 => "rpr", # Resilient Packet Ring Interface Type |
|
320
|
|
|
|
|
|
|
226 => "qam", # RF Qam Interface |
|
321
|
|
|
|
|
|
|
227 => "lmp", # Link Management Protocol |
|
322
|
|
|
|
|
|
|
228 => "cblVectaStar", # Cambridge Broadband Networks Limited VectaStar |
|
323
|
|
|
|
|
|
|
229 => "docsCableMCmtsDownstream", # CATV Modular CMTS Downstream Interface |
|
324
|
|
|
|
|
|
|
230 => "adsl2", # Asymmetric Digital Subscriber Loop Version 2 |
|
325
|
|
|
|
|
|
|
# (DEPRECATED/OBSOLETED - please use adsl2plus 238 instead) |
|
326
|
|
|
|
|
|
|
231 => "macSecControlledIF", # MACSecControlled |
|
327
|
|
|
|
|
|
|
232 => "macSecUncontrolledIF", # MACSecUncontrolled |
|
328
|
|
|
|
|
|
|
233 => "aviciOpticalEther", # Avici Optical Ethernet Aggregate |
|
329
|
|
|
|
|
|
|
234 => "atmbond", # atmbond |
|
330
|
|
|
|
|
|
|
235 => "voiceFGDOS", # voice FGD Operator Services |
|
331
|
|
|
|
|
|
|
236 => "mocaVersion1", # MultiMedia over Coax Alliance (MoCA) Interface |
|
332
|
|
|
|
|
|
|
# as documented in information provided privately to IANA |
|
333
|
|
|
|
|
|
|
237 => "ieee80216WMAN", # IEEE 802.16 WMAN interface |
|
334
|
|
|
|
|
|
|
238 => "adsl2plus", # Asymmetric Digital Subscriber Loop Version 2, |
|
335
|
|
|
|
|
|
|
# Version 2 Plus and all variants |
|
336
|
|
|
|
|
|
|
239 => "dvbRcsMacLayer", # DVB-RCS MAC Layer |
|
337
|
|
|
|
|
|
|
240 => "dvbTdm", # DVB Satellite TDM |
|
338
|
|
|
|
|
|
|
241 => "dvbRcsTdma", # DVB-RCS TDMA |
|
339
|
|
|
|
|
|
|
242 => "x86Laps", # LAPS based on ITU-T X.86/Y.1323 |
|
340
|
|
|
|
|
|
|
243 => "wwanPP", # 3GPP WWAN |
|
341
|
|
|
|
|
|
|
244 => "wwanPP2", # 3GPP2 WWAN |
|
342
|
|
|
|
|
|
|
245 => "voiceEBS", # voice P-phone EBS physical interface |
|
343
|
|
|
|
|
|
|
246 => "ifPwType", # Pseudowire interface type |
|
344
|
|
|
|
|
|
|
247 => "ilan", # Internal LAN on a bridge per IEEE 802.1ap |
|
345
|
|
|
|
|
|
|
248 => "pip", # Provider Instance Port on a bridge per IEEE 802.1ah PBB |
|
346
|
|
|
|
|
|
|
249 => "aluELP", # Alcatel-Lucent Ethernet Link Protection |
|
347
|
|
|
|
|
|
|
250 => "gpon", # Gigabit-capable passive optical networks (G-PON) as per ITU-T G.948 |
|
348
|
|
|
|
|
|
|
251 => "vdsl2", # Very high speed digital subscriber line Version 2 |
|
349
|
|
|
|
|
|
|
# (as per ITU-T Recommendation G.993.2) |
|
350
|
|
|
|
|
|
|
252 => "capwapDot11Profile", # WLAN Profile Interface |
|
351
|
|
|
|
|
|
|
253 => "capwapDot11Bss", # WLAN BSS Interface |
|
352
|
|
|
|
|
|
|
254 => "capwapWtpVirtualRadio", # WTP Virtual Radio Interface |
|
353
|
|
|
|
|
|
|
255 => "bits", # bitsport |
|
354
|
|
|
|
|
|
|
256 => "docsCableUpstreamRfPort", # DOCSIS CATV Upstream RF Port |
|
355
|
|
|
|
|
|
|
257 => "cableDownstreamRfPort " # CATV downstream RF port |
|
356
|
|
|
|
|
|
|
}, |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
'ifRcvAddressType' => { |
|
359
|
|
|
|
|
|
|
1 => "other", |
|
360
|
|
|
|
|
|
|
2 => "volatile", |
|
361
|
|
|
|
|
|
|
3 => "nonVolatile", |
|
362
|
|
|
|
|
|
|
}, |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# SNMPv2-TC |
|
365
|
|
|
|
|
|
|
'TruthValue' => { # RFC-1903 |
|
366
|
|
|
|
|
|
|
1 => 'true', |
|
367
|
|
|
|
|
|
|
2 => 'false', |
|
368
|
|
|
|
|
|
|
}, |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
'StorageType' => { |
|
371
|
|
|
|
|
|
|
1 => "other", |
|
372
|
|
|
|
|
|
|
2 => "volatile", # e.g., in RAM |
|
373
|
|
|
|
|
|
|
3 => "nonVolatile", # e.g., in NVRAM |
|
374
|
|
|
|
|
|
|
4 => "permanent", # e.g., partially in ROM |
|
375
|
|
|
|
|
|
|
5 => "readOnly", # e.g., completely in ROM |
|
376
|
|
|
|
|
|
|
}, |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
); |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
# ============================================================================= |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
=head2 isup() |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
isup( $value ); |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
If $value is "1", function returns 1. If values else this returns 0. |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=head2 updown() |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
updown( $value ); |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
If $value is "1", function returns string 'up'. Else returns 'down'. |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
=cut |
|
399
|
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
401
|
|
|
|
|
|
|
sub isup |
|
402
|
|
|
|
|
|
|
{ |
|
403
|
16
|
|
100
|
16
|
1
|
47
|
my $value = shift || 0; |
|
404
|
16
|
100
|
|
|
|
64
|
return ($value eq "1")? 1: 0; |
|
405
|
|
|
|
|
|
|
} |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
sub updown |
|
408
|
|
|
|
|
|
|
{ |
|
409
|
8
|
100
|
|
8
|
1
|
22
|
return isup(@_)? 'up': 'down'; |
|
410
|
|
|
|
|
|
|
} |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
# ============================================================================= |
|
413
|
|
|
|
|
|
|
=head1 METHODS |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=head2 new() |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
$tc = Net::SNMP::Util::TC->new(); |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
First creat an object for conversion. No arguments are need for this class. |
|
420
|
|
|
|
|
|
|
Then call method, which name is same as MIB name, with passing value you want to |
|
421
|
|
|
|
|
|
|
convert. e.g.; |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
$type = $tc->ifType( 132 ); # "coffee" |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=head2 Avaiable Methods |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
Textual conversion methods now avaiable are; |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=over |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=item ifAdminStatus() |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
For conversion value of MIB ifAdminStatus. |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=item ifOperStatus() |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
For conversion value of MIB ifOperStatus. |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=item ifType() |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
For conversion value of MIB ifType. MIB ifType is now defined as IANAifType. |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=item ifRcvAddressType() |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
For conversion value of MIB ifRcvAddressType. |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=item TruthValue() |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
For conversion value of MIB TruthValue. |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=item StorageType() |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
For conversion value of MIB StorageType. |
|
454
|
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=back |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=cut |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
sub new { |
|
460
|
1
|
|
|
1
|
1
|
2
|
my $class = shift; |
|
461
|
1
|
|
|
|
|
2
|
bless \eval{ my $s }, $class; |
|
|
1
|
|
|
|
|
7
|
|
|
462
|
|
|
|
|
|
|
} |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# ============================================================================= |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head1 METHODS |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=cut |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
sub AUTOLOAD |
|
471
|
|
|
|
|
|
|
{ |
|
472
|
6
|
|
|
6
|
|
479
|
my ($self, $value) = @_; |
|
473
|
6
|
|
|
|
|
8
|
my $method = our $AUTOLOAD; # $method = MIB name |
|
474
|
|
|
|
|
|
|
|
|
475
|
6
|
|
|
|
|
37
|
$method =~ s/.*:://o; |
|
476
|
|
|
|
|
|
|
|
|
477
|
6
|
50
|
|
|
|
37
|
if ( exists $_TC_base{$method} ) |
|
478
|
|
|
|
|
|
|
{ |
|
479
|
2
|
|
|
2
|
|
14
|
no strict 'refs'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
492
|
|
|
480
|
6
|
|
|
|
|
20
|
*{$method} = sub { |
|
481
|
8
|
|
|
8
|
|
13
|
my ($s,$v) = @_; |
|
482
|
8
|
50
|
|
|
|
21
|
if ( defined $v ){ |
|
483
|
8
|
|
|
|
|
55
|
return $_TC_base{$method}->{$v}; |
|
484
|
|
|
|
|
|
|
} else { |
|
485
|
0
|
|
|
|
|
0
|
Carp("Undefined value was given"); |
|
486
|
|
|
|
|
|
|
} |
|
487
|
0
|
|
|
|
|
0
|
return undef; |
|
488
|
6
|
|
|
|
|
30
|
}; |
|
489
|
6
|
|
|
|
|
19
|
return $method->($self,$value); |
|
490
|
|
|
|
|
|
|
} |
|
491
|
0
|
|
|
|
|
0
|
return undef; |
|
492
|
|
|
|
|
|
|
} |
|
493
|
|
|
|
|
|
|
|
|
494
|
0
|
|
|
0
|
|
0
|
sub DESTROY {} |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=head2 TRUE() |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
This method always returns 1 which is defined as true value in MIB TruthValue |
|
501
|
|
|
|
|
|
|
at RFC-1903. |
|
502
|
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head2 FALSE() |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
This method always returns 2 which is defined as false value in MIB TruthValue |
|
506
|
|
|
|
|
|
|
at RFC-1903. |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=cut |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
511
|
1
|
|
|
1
|
1
|
4
|
sub TRUE { 1 }; |
|
512
|
1
|
|
|
1
|
1
|
5
|
sub FALSE { 2 }; |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
# ============================================================================= |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=head1 AUTHOR |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
t.onodera, C<< >> |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
L, L |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
Copyright(C) 2010 Takahiro Ondoera. |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
This program is free software; you may redistribute it and/or modify it under |
|
530
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=cut |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
1; # End of Net::SNMP::Util::TC |