| 1 | # SNMP::Info::Layer3::AlcatelLucent | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008 Bill Fenner | ||
| 4 | # | ||
| 5 | # Redistribution and use in source and binary forms, with or without | ||
| 6 | # modification, are permitted provided that the following conditions are met: | ||
| 7 | # | ||
| 8 | # * Redistributions of source code must retain the above copyright notice, | ||
| 9 | # this list of conditions and the following disclaimer. | ||
| 10 | # * Redistributions in binary form must reproduce the above copyright | ||
| 11 | # notice, this list of conditions and the following disclaimer in the | ||
| 12 | # documentation and/or other materials provided with the distribution. | ||
| 13 | # * Neither the name of the University of California, Santa Cruz nor the | ||
| 14 | # names of its contributors may be used to endorse or promote products | ||
| 15 | # derived from this software without specific prior written permission. | ||
| 16 | # | ||
| 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 21 | # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 27 | # POSSIBILITY OF SUCH DAMAGE. | ||
| 28 | |||
| 29 | package SNMP::Info::Layer3::AlcatelLucent; | ||
| 30 | |||
| 31 | use strict; | ||
| 32 | use warnings; | ||
| 33 | |||
| 34 | use Exporter; | ||
| 35 | use SNMP::Info::Layer3; | ||
| 36 | use SNMP::Info::MAU; | ||
| 37 | use SNMP::Info::AMAP; | ||
| 38 | # Use LLDP | ||
| 39 | # (or at least try. The versions I've seen have two problems: | ||
| 40 | # 1. they report ifIndex values as 'local'; we don't support ifIndex | ||
| 41 | # but *could* | ||
| 42 | # 2. They report 0.0.0.0 as the management address | ||
| 43 | # ) | ||
| 44 | use SNMP::Info::LLDP; | ||
| 45 | |||
| 46 | @SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::AMAP SNMP::Info::LLDP | ||
| 47 | SNMP::Info::MAU SNMP::Info::Layer3 Exporter/; | ||
| 48 | @SNMP::Info::Layer3::AlcatelLucent::EXPORT_OK = qw//; | ||
| 49 | |||
| 50 | our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); | ||
| 51 | |||
| 52 | $VERSION = '3.985004'; | ||
| 53 | |||
| 54 | %MIBS = ( | ||
| 55 | %SNMP::Info::Layer3::MIBS, | ||
| 56 | %SNMP::Info::MAU::MIBS, | ||
| 57 | %SNMP::Info::LLDP::MIBS, | ||
| 58 | %SNMP::Info::AMAP::MIBS, | ||
| 59 | 'ALCATEL-IND1-DEVICES' => 'familyOmniSwitch7000', | ||
| 60 | 'ALCATEL-IND1-CHASSIS-MIB' => 'chasEntPhysOperStatus', | ||
| 61 | 'ALCATEL-IND1-VLAN-MGR-MIB' => 'vpaType', | ||
| 62 | 'ALU-POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus', | ||
| 63 | ); | ||
| 64 | |||
| 65 | # Alcatel's AOS 6 copy of the POWER-ETHERNET-MIB lives in vendor space | ||
| 66 | # without renaming any objects, while AOS 8 implements the standard MIB. | ||
| 67 | # With both modules loaded a bare leaf name resolves to whichever loaded | ||
| 68 | # last, so every peth column is qualified with its MIB name. | ||
| 69 | |||
| 70 | %GLOBALS = ( | ||
| 71 | %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::MAU::GLOBALS, | ||
| 72 | %SNMP::Info::LLDP::GLOBALS, %SNMP::Info::AMAP::GLOBALS, | ||
| 73 | ); | ||
| 74 | |||
| 75 | %FUNCS = ( | ||
| 76 | %SNMP::Info::Layer3::FUNCS, %SNMP::Info::MAU::FUNCS, | ||
| 77 | %SNMP::Info::LLDP::FUNCS, %SNMP::Info::AMAP::FUNCS, | ||
| 78 | |||
| 79 | # POWER-ETHERNET-MIB (standard, AOS 8) | ||
| 80 | 'std_peth_port_admin' => 'POWER_ETHERNET_MIB__pethPsePortAdminEnable', | ||
| 81 | 'std_peth_port_status' => | ||
| 82 | 'POWER_ETHERNET_MIB__pethPsePortDetectionStatus', | ||
| 83 | 'std_peth_port_class' => | ||
| 84 | 'POWER_ETHERNET_MIB__pethPsePortPowerClassifications', | ||
| 85 | 'std_peth_power_watts' => 'POWER_ETHERNET_MIB__pethMainPsePower', | ||
| 86 | 'std_peth_power_status' => 'POWER_ETHERNET_MIB__pethMainPseOperStatus', | ||
| 87 | 'std_peth_power_consumption' => | ||
| 88 | 'POWER_ETHERNET_MIB__pethMainPseConsumptionPower', | ||
| 89 | 'std_peth_power_threshold' => | ||
| 90 | 'POWER_ETHERNET_MIB__pethMainPseUsageThreshold', | ||
| 91 | |||
| 92 | # ALU-POWER-ETHERNET-MIB (vendor copy, AOS 6) | ||
| 93 | 'alu_peth_port_admin' => 'ALU_POWER_ETHERNET_MIB__pethPsePortAdminEnable', | ||
| 94 | 'alu_peth_port_status' => | ||
| 95 | 'ALU_POWER_ETHERNET_MIB__pethPsePortDetectionStatus', | ||
| 96 | 'alu_peth_port_class' => | ||
| 97 | 'ALU_POWER_ETHERNET_MIB__pethPsePortPowerClassifications', | ||
| 98 | 'alu_peth_power_watts' => 'ALU_POWER_ETHERNET_MIB__pethMainPsePower', | ||
| 99 | 'alu_peth_power_status' => | ||
| 100 | 'ALU_POWER_ETHERNET_MIB__pethMainPseOperStatus', | ||
| 101 | 'alu_peth_power_consumption' => | ||
| 102 | 'ALU_POWER_ETHERNET_MIB__pethMainPseConsumptionPower', | ||
| 103 | 'alu_peth_power_threshold' => | ||
| 104 | 'ALU_POWER_ETHERNET_MIB__pethMainPseUsageThreshold', | ||
| 105 | |||
| 106 | # ALCATEL-IND1-CHASSIS-MIB::chasEntPhysicalTable | ||
| 107 | 'alu_chas_oper_status' => 'chasEntPhysOperStatus', | ||
| 108 | |||
| 109 | # ALCATEL-IND1-VLAN-MGR-MIB::vlanTable | ||
| 110 | 'alu_vlan_descr' => 'vlanDescription', | ||
| 111 | |||
| 112 | # ALCATEL-IND1-VLAN-MGR-MIB::vpaTable | ||
| 113 | 'alu_vpa_type' => 'vpaType', | ||
| 114 | |||
| 115 | # AOS 8 copies of the tables above, in the .6486.801 tree that | ||
| 116 | # netdisco-mibs does not define (it has only the AOS 6 tree, .6486.800). | ||
| 117 | # ALE ships the AOS 8 MIBs under the same module names, so both sets | ||
| 118 | # cannot load together (netdisco-mibs#165). | ||
| 119 | # ALCATEL-IND1-CHASSIS-MIB::chasEntPhysOperStatus | ||
| 120 | 'alu8_chas_oper_status' => '.1.3.6.1.4.1.6486.801.1.1.1.1.1.1.1.2', | ||
| 121 | # ALCATEL-IND1-VLAN-MGR-MIB::vlanDescription | ||
| 122 | 'alu8_vlan_descr' => '.1.3.6.1.4.1.6486.801.1.2.1.3.1.1.1.1.1.2', | ||
| 123 | # ALCATEL-IND1-VLAN-MGR-MIB::vpaType | ||
| 124 | 'alu8_vpa_type' => '.1.3.6.1.4.1.6486.801.1.2.1.3.1.1.2.1.1.3', | ||
| 125 | ); | ||
| 126 | |||
| 127 | %MUNGE = ( | ||
| 128 | %SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE, | ||
| 129 | %SNMP::Info::LLDP::MUNGE, %SNMP::Info::AMAP::MUNGE, | ||
| 130 | 'alu8_chas_oper_status' => | ||
| 131 | \&SNMP::Info::Layer3::AlcatelLucent::munge_alu8_chas_oper_status, | ||
| 132 | ); | ||
| 133 | |||
| 134 | # use MAU-MIB for admin. duplex and admin. speed | ||
| 135 | *SNMP::Info::Layer3::AlcatelLucent::i_duplex_admin | ||
| 136 | = \&SNMP::Info::MAU::mau_i_duplex_admin; | ||
| 137 | *SNMP::Info::Layer3::AlcatelLucent::i_speed_admin | ||
| 138 | = \&SNMP::Info::MAU::mau_i_speed_admin; | ||
| 139 | |||
| 140 | sub model { | ||
| 141 | my $alu = shift; | ||
| 142 | my $id = $alu->id(); | ||
| 143 | my $model = &SNMP::translateObj($id); | ||
| 144 | |||
| 145 | if ( defined $model and $model !~ m/[.]/ ) { | ||
| 146 | $model =~ s/^device//; | ||
| 147 | return $model; | ||
| 148 | } | ||
| 149 | |||
| 150 | # AOS 8 device IDs sit in the .6486.801 tree, which netdisco-mibs does | ||
| 151 | # not define, and newer AOS 6 IDs are missing from its device list, so | ||
| 152 | # they translate only partly. No vendor object names the model. | ||
| 153 | my $descr_model = $alu->_descr_model(); | ||
| 154 | return $descr_model if defined $descr_model; | ||
| 155 | |||
| 156 | my $chassis_model = $alu->_chassis_model(); | ||
| 157 | return $chassis_model if defined $chassis_model; | ||
| 158 | |||
| 159 | return defined $model ? $model : $id; | ||
| 160 | } | ||
| 161 | |||
| 162 | # The model sysDescr names just before the release os_ver reads, as in | ||
| 163 | # "Alcatel-Lucent Enterprise OS6360-P48X 8.10.105.R02 GA, ..." | ||
| 164 | sub _descr_model { | ||
| 165 | my $alu = shift; | ||
| 166 | |||
| 167 | my $descr = $alu->description(); | ||
| 168 | return unless defined $descr; | ||
| 169 | return $1 | ||
| 170 | if $descr =~ m/\b(OS\d[\w-]*) \d[\.\d]+R\d+ (?:GA|Service Release), /; | ||
| 171 | return; | ||
| 172 | } | ||
| 173 | |||
| 174 | # The model of the lowest-numbered chassis entity, the first member of a | ||
| 175 | # virtual chassis | ||
| 176 | sub _chassis_model { | ||
| 177 | my $alu = shift; | ||
| 178 | |||
| 179 | my $e_class = $alu->e_class() || {}; | ||
| 180 | my $e_model = $alu->e_model() || {}; | ||
| 181 | foreach my $index ( sort { $a <=> $b } keys %$e_class ) { | ||
| 182 | next unless $e_class->{$index} eq 'chassis'; | ||
| 183 | my $model = $e_model->{$index}; | ||
| 184 | return $model if defined $model and length $model; | ||
| 185 | } | ||
| 186 | return; | ||
| 187 | } | ||
| 188 | |||
| 189 | sub os { | ||
| 190 | return 'AOS'; | ||
| 191 | } | ||
| 192 | |||
| 193 | sub vendor { | ||
| 194 | return 'alcatel-lucent'; | ||
| 195 | } | ||
| 196 | |||
| 197 | sub os_ver { | ||
| 198 | my $alu = shift; | ||
| 199 | |||
| 200 | my $descr = $alu->description(); | ||
| 201 | if (defined ($descr)) { | ||
| 202 | return $1 if $descr =~ m/\b(\d[\.\d]+R\d+) (?:GA|Service Release), /; | ||
| 203 | } | ||
| 204 | |||
| 205 | # No clue what this will try but hey | ||
| 206 | return $alu->SUPER::os_ver(); | ||
| 207 | } | ||
| 208 | |||
| 209 | # ps1_type, ps1_status, ps2_type, ps2_status: | ||
| 210 | # Find the list of power supplies in the ENTITY-MIB | ||
| 211 | # e_class = powerSupply | ||
| 212 | # e_descr = ps_type | ||
| 213 | # chasEntPhysOperStatus = ps_status | ||
| 214 | sub _power_supplies { | ||
| 215 | my $alu = shift; | ||
| 216 | |||
| 217 | my $e_class = $alu->e_class(); | ||
| 218 | my @supplies = (); | ||
| 219 | |||
| 220 | foreach my $key ( sort { int($a) cmp int($b) } keys %$e_class ) { | ||
| 221 | if ( $e_class->{$key} eq 'powerSupply' ) { | ||
| 222 | push( @supplies, int($key) ); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | return @supplies; | ||
| 226 | } | ||
| 227 | |||
| 228 | sub _ps_type { | ||
| 229 | my $alu = shift; | ||
| 230 | my $psnum = shift; | ||
| 231 | my @ps = $alu->_power_supplies(); | ||
| 232 | |||
| 233 | if ( $psnum > $#ps ) { | ||
| 234 | return "none"; | ||
| 235 | } | ||
| 236 | my $supply = $ps[$psnum]; | ||
| 237 | my $descr = $alu->e_descr($supply); | ||
| 238 | return $descr->{$supply}; | ||
| 239 | } | ||
| 240 | |||
| 241 | sub _ps_status { | ||
| 242 | my $alu = shift; | ||
| 243 | my $psnum = shift; | ||
| 244 | my @ps = $alu->_power_supplies(); | ||
| 245 | |||
| 246 | if ( $psnum > $#ps ) { | ||
| 247 | return "not present"; | ||
| 248 | } | ||
| 249 | my $supply = $ps[$psnum]; | ||
| 250 | my $status = $alu->_chas_oper_status(); | ||
| 251 | return $status->{$supply}; | ||
| 252 | } | ||
| 253 | |||
| 254 | # AOS 6 serves chasEntPhysOperStatus where netdisco-mibs defines it, AOS 8 | ||
| 255 | # only in its own tree | ||
| 256 | sub _chas_oper_status { | ||
| 257 | my $alu = shift; | ||
| 258 | |||
| 259 | my $status = $alu->alu_chas_oper_status(); | ||
| 260 | return $status if ref $status eq 'HASH' and scalar keys %$status; | ||
| 261 | return $alu->alu8_chas_oper_status() || {}; | ||
| 262 | } | ||
| 263 | |||
| 264 | # Labels from the AOS 8 ALCATEL-IND1-CHASSIS-MIB, a superset of AOS 6's | ||
| 265 | my %alu8_chas_oper_labels = ( | ||
| 266 | 1 => 'up', | ||
| 267 | 2 => 'down', | ||
| 268 | 3 => 'testing', | ||
| 269 | 4 => 'unknown', | ||
| 270 | 5 => 'secondary', | ||
| 271 | 6 => 'notPresent', | ||
| 272 | 7 => 'unpowered', | ||
| 273 | 8 => 'master', | ||
| 274 | 9 => 'idle', | ||
| 275 | 10 => 'pwrsave', | ||
| 276 | ); | ||
| 277 | |||
| 278 | sub munge_alu8_chas_oper_status { | ||
| 279 | my $status = shift; | ||
| 280 | |||
| 281 | return $status unless defined $status; | ||
| 282 | return $alu8_chas_oper_labels{$status} // $status; | ||
| 283 | } | ||
| 284 | |||
| 285 | sub ps1_type { | ||
| 286 | my $alu = shift; | ||
| 287 | return $alu->_ps_type(0); | ||
| 288 | } | ||
| 289 | |||
| 290 | sub ps2_type { | ||
| 291 | my $alu = shift; | ||
| 292 | return $alu->_ps_type(1); | ||
| 293 | } | ||
| 294 | |||
| 295 | sub ps1_status { | ||
| 296 | my $alu = shift; | ||
| 297 | return $alu->_ps_status(0); | ||
| 298 | } | ||
| 299 | |||
| 300 | sub ps2_status { | ||
| 301 | my $alu = shift; | ||
| 302 | return $alu->_ps_status(1); | ||
| 303 | } | ||
| 304 | |||
| 305 | # The interface description contains the software version, so | ||
| 306 | # to avoid losing historical information through a software upgrade | ||
| 307 | # we use interface name instead. | ||
| 308 | sub interfaces { | ||
| 309 | my $alu = shift; | ||
| 310 | my $partial = shift; | ||
| 311 | |||
| 312 | return $alu->orig_i_name($partial); | ||
| 313 | } | ||
| 314 | |||
| 315 | # Work around buggy bp_index in 6.3.1.871.R01 and 6.3.1.975.R01 | ||
| 316 | sub bp_index { | ||
| 317 | my $alu = shift; | ||
| 318 | my $partial = shift; | ||
| 319 | |||
| 320 | my $bp_index = $alu->SUPER::bp_index($partial); | ||
| 321 | |||
| 322 | # | ||
| 323 | # This device sometimes reports an ifIndex and sometimes reports | ||
| 324 | # dot1dBasePort for the dot1d port values - e.g., | ||
| 325 | # in 6.3.1.871.R01 both dot1dTpFdbPort and dot1qTpFdbPort report | ||
| 326 | # the ifIndex; in 6.3.1.975.R01 dot1dTpFdbPort has been updated | ||
| 327 | # to report the dot1dBasePort but dot1qTpFdbPort still returns an | ||
| 328 | # ifIndex. For this reason, we augment the dot1dBasePort | ||
| 329 | # mapping with ifIndex->ifIndex mappings -- we can do this because | ||
| 330 | # the ifIndex and dot1dBasePort spaces don't overlap, at least for | ||
| 331 | # the ports we care about. | ||
| 332 | my @keys = keys %$bp_index; | ||
| 333 | foreach my $idx (@keys) { | ||
| 334 | my $ifIndex = $bp_index->{$idx}; | ||
| 335 | $bp_index->{$ifIndex} = $ifIndex; | ||
| 336 | } | ||
| 337 | |||
| 338 | # | ||
| 339 | # In addition, aggregates aren't reported at all in bp_index. | ||
| 340 | # We grab them from i_index. | ||
| 341 | my $i_index = $alu->i_index(); | ||
| 342 | foreach my $idx ( keys %$i_index ) { | ||
| 343 | my $ifIndex = $i_index->{$idx}; | ||
| 344 | if ( int($ifIndex) > 40000001 ) { | ||
| 345 | $bp_index->{$ifIndex} = $ifIndex; | ||
| 346 | |||
| 347 | # dot1dTpFdbPort seems to use 4098, 4099, 4100 for | ||
| 348 | # 40000001, 40000002, 40000003. I guess this is | ||
| 349 | # 4096 + 1 + aggregate number. | ||
| 350 | my $tmp = sprintf( "%d", int($ifIndex) - 39995903 ); | ||
| 351 | $bp_index->{$tmp} = $ifIndex; | ||
| 352 | } | ||
| 353 | } | ||
| 354 | return $bp_index; | ||
| 355 | } | ||
| 356 | |||
| 357 | # AOS 8 (and some AOS 6 releases) leave dot1qPvid empty, so fall back to | ||
| 358 | # the configured default VLAN in vpaTable, indexed by vlan.ifIndex. A port | ||
| 359 | # listed as default in more than one VLAN is ambiguous and left out. | ||
| 360 | sub i_vlan { | ||
| 361 | my $alu = shift; | ||
| 362 | my $partial = shift; | ||
| 363 | |||
| 364 | my $i_vlan = $alu->SUPER::i_vlan($partial); | ||
| 365 | return $i_vlan if ref $i_vlan eq 'HASH' and scalar keys %$i_vlan; | ||
| 366 | |||
| 367 | my $vpa_type = $alu->alu_vpa_type(); | ||
| 368 | unless ( ref $vpa_type eq 'HASH' and scalar keys %$vpa_type ) { | ||
| 369 | $vpa_type = $alu->alu8_vpa_type(); | ||
| 370 | } | ||
| 371 | return {} unless ref $vpa_type eq 'HASH'; | ||
| 372 | |||
| 373 | my %defaults; | ||
| 374 | foreach my $iid ( keys %$vpa_type ) { | ||
| 375 | my $type = $vpa_type->{$iid}; | ||
| 376 | next unless defined $type and $type =~ m/^(?:cfgDefault|1)$/; | ||
| 377 | my ( $vlan, $ifindex ) = split( m/\./, $iid ); | ||
| 378 | next if defined $partial and $ifindex ne $partial; | ||
| 379 | push @{ $defaults{$ifindex} }, $vlan; | ||
| 380 | } | ||
| 381 | |||
| 382 | my $default_vlan = {}; | ||
| 383 | foreach my $ifindex ( keys %defaults ) { | ||
| 384 | my @vlans = @{ $defaults{$ifindex} }; | ||
| 385 | $default_vlan->{$ifindex} = $vlans[0] if scalar @vlans == 1; | ||
| 386 | } | ||
| 387 | return $default_vlan; | ||
| 388 | } | ||
| 389 | |||
| 390 | # AOS 8 keeps VLAN names in its own vlanTable, and its Q-BRIDGE-MIB carries | ||
| 391 | # none or placeholders on some releases, so the vendor table comes first. | ||
| 392 | # Q-BRIDGE-MIB next, as some releases name VLANs correctly there, then the | ||
| 393 | # AOS 6 vlanTable, as on releases whose Q-BRIDGE-MIB has no names. | ||
| 394 | sub v_name { | ||
| 395 | my $alu = shift; | ||
| 396 | my $partial = shift; | ||
| 397 | |||
| 398 | foreach my $source (qw/alu8_vlan_descr qb_v_name alu_vlan_descr/) { | ||
| 399 | my $names = $alu->$source($partial); | ||
| 400 | return $names if ref $names eq 'HASH' and scalar keys %$names; | ||
| 401 | } | ||
| 402 | return; | ||
| 403 | } | ||
| 404 | |||
| 405 | # One PoE source per device: the standard MIB when its port table has | ||
| 406 | # rows, otherwise the AOS 6 vendor copy. | ||
| 407 | sub _peth_table { | ||
| 408 | my $alu = shift; | ||
| 409 | my $method = shift; | ||
| 410 | my $partial = shift; | ||
| 411 | |||
| 412 | my $std_status = $alu->std_peth_port_status(); | ||
| 413 | my $source | ||
| 414 | = ( ref $std_status eq 'HASH' and scalar keys %$std_status ) | ||
| 415 | ? 'std' | ||
| 416 | : 'alu'; | ||
| 417 | my $leaf_method = "${source}_$method"; | ||
| 418 | my $table = $alu->$leaf_method($partial); | ||
| 419 | return $table; | ||
| 420 | } | ||
| 421 | |||
| 422 | sub peth_port_admin { | ||
| 423 | my ( $alu, $partial ) = @_; | ||
| 424 | return $alu->_peth_table( 'peth_port_admin', $partial ); | ||
| 425 | } | ||
| 426 | |||
| 427 | sub peth_port_status { | ||
| 428 | my ( $alu, $partial ) = @_; | ||
| 429 | return $alu->_peth_table( 'peth_port_status', $partial ); | ||
| 430 | } | ||
| 431 | |||
| 432 | sub peth_port_class { | ||
| 433 | my ( $alu, $partial ) = @_; | ||
| 434 | return $alu->_peth_table( 'peth_port_class', $partial ); | ||
| 435 | } | ||
| 436 | |||
| 437 | sub peth_power_watts { | ||
| 438 | my ( $alu, $partial ) = @_; | ||
| 439 | return $alu->_peth_table( 'peth_power_watts', $partial ); | ||
| 440 | } | ||
| 441 | |||
| 442 | sub peth_power_status { | ||
| 443 | my ( $alu, $partial ) = @_; | ||
| 444 | return $alu->_peth_table( 'peth_power_status', $partial ); | ||
| 445 | } | ||
| 446 | |||
| 447 | sub peth_power_consumption { | ||
| 448 | my ( $alu, $partial ) = @_; | ||
| 449 | return $alu->_peth_table( 'peth_power_consumption', $partial ); | ||
| 450 | } | ||
| 451 | |||
| 452 | sub peth_power_threshold { | ||
| 453 | my ( $alu, $partial ) = @_; | ||
| 454 | return $alu->_peth_table( 'peth_power_threshold', $partial ); | ||
| 455 | } | ||
| 456 | |||
| 457 | # Power-Ethernet ifIndex mapping. I've only seen this from a | ||
| 458 | # fixed-config single-module system, so this is only a plausible | ||
| 459 | # guess as to the mapping on a stack or modular system. | ||
| 460 | sub peth_port_ifindex { | ||
| 461 | my $alu = shift; | ||
| 462 | my $partial = shift; | ||
| 463 | |||
| 464 | my $peth_port_status = $alu->peth_port_status($partial); | ||
| 465 | my $peth_port_ifindex = {}; | ||
| 466 | |||
| 467 | foreach my $key ( keys %$peth_port_status ) { | ||
| 468 | my @oid = split( m/\./, $key ); | ||
| 469 | $peth_port_ifindex->{$key} = int( $oid[0] ) * 1000 + int( $oid[1] ); | ||
| 470 | } | ||
| 471 | return $peth_port_ifindex; | ||
| 472 | } | ||
| 473 | |||
| 474 | 1; | ||
| 475 | __END__ |