| 1 | # SNMP::Info::Layer3::Whiterabbit - SNMP Interface to Whiterabbit | ||
| 2 | # | ||
| 3 | # Copyright (c) 2020 Christoph Handel GSI Helmholtzzentrum fuer | ||
| 4 | # Schwerionenforschung | ||
| 5 | # | ||
| 6 | # Copyright (c) 2008-2009 Max Baker changes from version 0.8 and beyond. | ||
| 7 | # | ||
| 8 | # Copyright (c) 2002,2003 Regents of the University of California | ||
| 9 | # | ||
| 10 | # All rights reserved. | ||
| 11 | # | ||
| 12 | # Redistribution and use in source and binary forms, with or without | ||
| 13 | # modification, are permitted provided that the following conditions are met: | ||
| 14 | # | ||
| 15 | # * Redistributions of source code must retain the above copyright notice, | ||
| 16 | # this list of conditions and the following disclaimer. | ||
| 17 | # * Redistributions in binary form must reproduce the above copyright | ||
| 18 | # notice, this list of conditions and the following disclaimer in the | ||
| 19 | # documentation and/or other materials provided with the distribution. | ||
| 20 | # * Neither the name of the University of California, Santa Cruz , | ||
| 21 | # the GSI Helmholtzzentrum fuer Schwerionenforschung, nor the | ||
| 22 | # names of its contributors may be used to endorse or promote products | ||
| 23 | # derived from this software without specific prior written permission | ||
| 24 | # | ||
| 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 26 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 27 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 28 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 29 | # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 30 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 31 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 32 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 33 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 34 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 35 | # POSSIBILITY OF SUCH DAMAGE. | ||
| 36 | # | ||
| 37 | |||
| 38 | package SNMP::Info::Layer3::Whiterabbit; | ||
| 39 | |||
| 40 | use strict; | ||
| 41 | use warnings; | ||
| 42 | use Exporter; | ||
| 43 | use SNMP::Info::Layer3; | ||
| 44 | use SNMP::Info::MAU; | ||
| 45 | |||
| 46 | |||
| 47 | @SNMP::Info::Layer3::Whiterabbit::ISA = qw/ | ||
| 48 | SNMP::Info::Layer3 | ||
| 49 | SNMP::Info::MAU | ||
| 50 | Exporter | ||
| 51 | /; | ||
| 52 | @SNMP::Info::Layer3::Whiterabbit::EXPORT_OK = qw//; | ||
| 53 | |||
| 54 | our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %PORTSTAT, %MODEL_MAP, %MUNGE); | ||
| 55 | |||
| 56 | $VERSION = '3.985003'; | ||
| 57 | |||
| 58 | %MIBS = ( | ||
| 59 | %SNMP::Info::Layer3::MIBS, | ||
| 60 | %SNMP::Info::MAU::MIBS, | ||
| 61 | 'WR-SWITCH-MIB' => 'wrsScalar', | ||
| 62 | ); | ||
| 63 | |||
| 64 | %GLOBALS = ( | ||
| 65 | %SNMP::Info::Layer3::GLOBALS, | ||
| 66 | %SNMP::Info::MAU::GLOBALS, | ||
| 67 | 'serial1' => 'wrsVersionSwitchSerialNumber.0', | ||
| 68 | 'vendor1' => 'wrsVersionManufacturer.0', | ||
| 69 | 'os_ver' => 'wrsVersionSwVersion.0', | ||
| 70 | ); | ||
| 71 | |||
| 72 | %FUNCS = ( | ||
| 73 | %SNMP::Info::Layer3::FUNCS, | ||
| 74 | %SNMP::Info::MAU::FUNCS, | ||
| 75 | ); | ||
| 76 | |||
| 77 | %MUNGE = ( | ||
| 78 | # Inherit all the built in munging | ||
| 79 | %SNMP::Info::Layer3::MUNGE, | ||
| 80 | %SNMP::Info::MAU::MUNGE, | ||
| 81 | ); | ||
| 82 | |||
| 83 | sub layers { | ||
| 84 | # not reporting anything in sysServices | ||
| 85 | # but it sure is a bridge and can do 2 | ||
| 86 | # at some later point it might get 3, so put it in layer3 right from the start | ||
| 87 | return '00000111'; | ||
| 88 | } | ||
| 89 | |||
| 90 | sub os { | ||
| 91 | return 'whiterabbit'; | ||
| 92 | } | ||
| 93 | |||
| 94 | sub vendor { | ||
| 95 | my $whiterabbit = shift; | ||
| 96 | return $whiterabbit->vendor1(); | ||
| 97 | } | ||
| 98 | |||
| 99 | sub mac { | ||
| 100 | # use dot1dBaseBridgeAddress | ||
| 101 | my $whiterabbit = shift; | ||
| 102 | return $whiterabbit->b_mac(); | ||
| 103 | } | ||
| 104 | |||
| 105 | 1; | ||
| 106 | |||
| 107 | __END__ |