| 1 | # SNMP::Info::Layer3::C4000 | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008 Bill Fenner | ||
| 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::Layer3::C4000; | ||
| 31 | |||
| 32 | use strict; | ||
| 33 | use warnings; | ||
| 34 | use Exporter; | ||
| 35 | use SNMP::Info::Layer3::CiscoSwitch; | ||
| 36 | use SNMP::Info::MAU; | ||
| 37 | |||
| 38 | @SNMP::Info::Layer3::C4000::ISA = qw/ | ||
| 39 | SNMP::Info::Layer3::CiscoSwitch | ||
| 40 | SNMP::Info::MAU | ||
| 41 | Exporter/; | ||
| 42 | @SNMP::Info::Layer3::C4000::EXPORT_OK = qw//; | ||
| 43 | |||
| 44 | our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); | ||
| 45 | |||
| 46 | $VERSION = '3.985003'; | ||
| 47 | |||
| 48 | %MIBS = ( | ||
| 49 | %SNMP::Info::MAU::MIBS, | ||
| 50 | %SNMP::Info::Layer3::CiscoSwitch::MIBS, | ||
| 51 | 'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB', | ||
| 52 | ); | ||
| 53 | |||
| 54 | %GLOBALS = ( | ||
| 55 | %SNMP::Info::MAU::GLOBALS, | ||
| 56 | %SNMP::Info::Layer3::CiscoSwitch::GLOBALS, | ||
| 57 | 'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1', | ||
| 58 | 'ps1_status' => 'ciscoEnvMonSupplyState.1', | ||
| 59 | 'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2', | ||
| 60 | 'ps2_status' => 'ciscoEnvMonSupplyState.2', | ||
| 61 | ); | ||
| 62 | |||
| 63 | %FUNCS = ( | ||
| 64 | %SNMP::Info::MAU::FUNCS, | ||
| 65 | %SNMP::Info::Layer3::CiscoSwitch::FUNCS, | ||
| 66 | 'fan_state' => 'ciscoEnvMonFanState', | ||
| 67 | 'fan_descr' => 'ciscoEnvMonFanStatusDescr', | ||
| 68 | ); | ||
| 69 | |||
| 70 | %MUNGE | ||
| 71 | = ( %SNMP::Info::MAU::MUNGE, %SNMP::Info::Layer3::CiscoSwitch::MUNGE, ); | ||
| 72 | |||
| 73 | # Override Inheritance for these specific methods | ||
| 74 | # use MAU-MIB for admin. duplex and admin. speed | ||
| 75 | *SNMP::Info::Layer3::C4000::i_duplex_admin | ||
| 76 | = \&SNMP::Info::MAU::mau_i_duplex_admin; | ||
| 77 | *SNMP::Info::Layer3::C4000::i_speed_admin | ||
| 78 | = \&SNMP::Info::MAU::mau_i_speed_admin; | ||
| 79 | |||
| 80 | *SNMP::Info::Layer3::C4000::set_i_duplex_admin | ||
| 81 | = \&SNMP::Info::MAU::mau_set_i_duplex_admin; | ||
| 82 | *SNMP::Info::Layer3::C4000::set_i_speed_admin | ||
| 83 | = \&SNMP::Info::MAU::mau_set_i_speed_admin; | ||
| 84 | |||
| 85 | sub fan { | ||
| 86 | my $c4000 = shift; | ||
| 87 | my $fan_state = $c4000->fan_state(); | ||
| 88 | my $fan_descr = $c4000->fan_descr(); | ||
| 89 | my $ret = ""; | ||
| 90 | my $s = ""; | ||
| 91 | foreach my $i ( sort { $a <=> $b } keys %$fan_state ) { | ||
| 92 | $ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i}; | ||
| 93 | $s = ", "; | ||
| 94 | } | ||
| 95 | return if ( $s eq "" ); | ||
| 96 | return $ret; | ||
| 97 | } | ||
| 98 | |||
| 99 | 1; | ||
| 100 | __END__ |