| 1 | package SNMP::Info::Layer3::VyOS; | ||
| 2 | |||
| 3 | # SNMP::Info::Layer3::VyOS | ||
| 4 | # | ||
| 5 | # Copyright (c) 2013 Eric Miller | ||
| 6 | # All rights reserved. | ||
| 7 | # | ||
| 8 | # Redistribution and use in source and binary forms, with or without | ||
| 9 | # modification, are permitted provided that the following conditions are met: | ||
| 10 | # | ||
| 11 | # * Redistributions of source code must retain the above copyright notice, | ||
| 12 | # this list of conditions and the following disclaimer. | ||
| 13 | # * Redistributions in binary form must reproduce the above copyright | ||
| 14 | # notice, this list of conditions and the following disclaimer in the | ||
| 15 | # documentation and/or other materials provided with the distribution. | ||
| 16 | # * Neither the name of the University of California, Santa Cruz nor the | ||
| 17 | # names of its contributors may be used to endorse or promote products | ||
| 18 | # derived from this software without specific prior written permission. | ||
| 19 | # | ||
| 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 21 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 22 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 23 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 24 | # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 25 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 26 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 27 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 28 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 29 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 30 | # POSSIBILITY OF SUCH DAMAGE. | ||
| 31 | |||
| 32 | |||
| 33 | use strict; | ||
| 34 | use warnings; | ||
| 35 | use Exporter; | ||
| 36 | use SNMP::Info::Layer3; | ||
| 37 | |||
| 38 | @SNMP::Info::Layer3::VyOS::ISA = qw/SNMP::Info::Layer3 Exporter/; | ||
| 39 | @SNMP::Info::Layer3::VyOS::EXPORT_OK = qw//; | ||
| 40 | |||
| 41 | our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE); | ||
| 42 | |||
| 43 | $VERSION = '3.985003'; | ||
| 44 | |||
| 45 | %MIBS = ( | ||
| 46 | %SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS, | ||
| 47 | ); | ||
| 48 | |||
| 49 | %GLOBALS = ( | ||
| 50 | %SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer3::GLOBALS, | ||
| 51 | ); | ||
| 52 | |||
| 53 | %FUNCS = ( %SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer3::FUNCS, ); | ||
| 54 | |||
| 55 | %MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer3::MUNGE, ); | ||
| 56 | |||
| 57 | sub layers { | ||
| 58 | return '01001100'; | ||
| 59 | } | ||
| 60 | |||
| 61 | sub os { | ||
| 62 | my $vyos = shift; | ||
| 63 | |||
| 64 | my $ver = $vyos->description() || ''; | ||
| 65 | |||
| 66 | if((lc $ver) =~ /vyos/){ | ||
| 67 | return 'VyOS'; | ||
| 68 | }else{ | ||
| 69 | return 'Vyatta'; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | sub model { | ||
| 74 | my $vyos = shift; | ||
| 75 | return $vyos->os(); | ||
| 76 | } | ||
| 77 | |||
| 78 | sub vendor { | ||
| 79 | my $vyos = shift; | ||
| 80 | return $vyos->os(); | ||
| 81 | } | ||
| 82 | |||
| 83 | sub os_ver { | ||
| 84 | my $vyos = shift; | ||
| 85 | |||
| 86 | my $ver = $vyos->description() || ''; | ||
| 87 | |||
| 88 | my @myver = reverse split(/ /, $ver); | ||
| 89 | |||
| 90 | return $myver[0]; | ||
| 91 | } | ||
| 92 | |||
| 93 | sub serial { | ||
| 94 | my $vyos = shift; | ||
| 95 | |||
| 96 | return $vyos->serialNumber(); | ||
| 97 | } | ||
| 98 | |||
| 99 | 1; | ||
| 100 | __END__ |