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 38package SNMP::Info::Layer3::Whiterabbit; 39 40use strict; 41use warnings; 42use Exporter; 43use SNMP::Info::Layer3; 44use 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 54our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %PORTSTAT, %MODEL_MAP, %MUNGE); 55 56$VERSION = '3.81'; 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 83sub 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 90sub os { 91 return 'whiterabbit'; 92} 93 94sub vendor { 95 my $whiterabbit = shift; 96 return $whiterabbit->vendor1(); 97} 98 99sub mac { 100 # use dot1dBaseBridgeAddress 101 my $whiterabbit = shift; 102 return $whiterabbit->b_mac(); 103} 104 1051; 106 107__END__ 108 109=head1 NAME 110 111SNMP::Info::Layer3::Whiterabbit - SNMP Interface to Whiterabbit Switches 112 113=head1 AUTHOR 114 115Christoph Handel 116 117=head1 SYNOPSIS 118 119 # Let SNMP::Info determine the correct subclass for you. 120 my $whiterabbit = new SNMP::Info( 121 AutoSpecify => 1, 122 Debug => 1, 123 DestHost => 'myswitch', 124 Community => 'public', 125 Version => 2 126 ) 127 or die "Can't connect to DestHost.\n"; 128 129 my $class = $whiterabbit->class(); 130 print "SNMP::Info determined this device to fall under subclass : $class\n"; 131 132=head1 DESCRIPTION 133 134Provides abstraction to the configuration information obtainable from a 135Whiterabbit Switch via SNMP. 136 137=head2 Inherited Classes 138 139=over 140 141=item SNMP::Info::Layer3 142 143=item SNMP::Info::MAU 144 145=back 146 147=head2 Required MIBs 148 149=over 150 151=item F<WR-SWITCH-MIB> 152 153=item F<WRS-PRODUCTS-MIB> 154 155=back 156 157L<https://github.com/GSI-CS-CO/wrs_mibs.git> 158 159=head1 GLOBALS 160 161These are methods that return scalar value from SNMP 162 163=over 164 165=item $whiterabbit->layers() 166 167Overwrite snmp value, we support 1-3 168 169=item $whiterabbit->os() 170 171statically returns whiterabbit 172 173=item $whiterabbit->vendor() 174 175return manufacturer as read from device. e.g. seven solutions, creotech, etc. 176 177=item $whiterabbit->model() 178 179as returned by mib. no meaningful translation 180 181=item $whiterabbit->mac() 182 183use the dot1dBaseBridgeAddress 184 185=item $whiterabbit->os_ver() 186 187including git hash 188 189=back 190 191=head2 Globals imported from SNMP::Info::Layer3 192 193See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. 194 195=head2 Globals imported from SNMP::Info::MAU 196 197See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details. 198 199=head1 TABLE METHODS 200 201These are methods that return tables of information in the form of a reference 202to a hash. 203 204=head2 Table Methods imported from SNMP::Info::Layer3 205 206See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. 207 208=head2 Table Methods imported from SNMP::Info::MAU 209 210See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details. 211 212=cut 213