| 1 | # SNMP::Info::Layer3::RuckusController - SmartZone and SmartCell Gateway | ||
| 2 | # | ||
| 3 | # Copyright (c) 2026 The SNMP::Info Developers | ||
| 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 copyright holder nor the names of its | ||
| 15 | # contributors may be used to endorse or promote products derived from | ||
| 16 | # 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::RuckusController; | ||
| 31 | |||
| 32 | use strict; | ||
| 33 | use warnings; | ||
| 34 | use Exporter; | ||
| 35 | use SNMP::Info::Layer3; | ||
| 36 | |||
| 37 | @SNMP::Info::Layer3::RuckusController::ISA = qw/SNMP::Info::Layer3 Exporter/; | ||
| 38 | @SNMP::Info::Layer3::RuckusController::EXPORT_OK = qw//; | ||
| 39 | |||
| 40 | our ( $VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE ); | ||
| 41 | $VERSION = '3.985003'; | ||
| 42 | |||
| 43 | %MIBS = ( | ||
| 44 | %SNMP::Info::Layer3::MIBS, | ||
| 45 | 'RUCKUS-PRODUCTS-MIB' => 'ruckusSCG200', | ||
| 46 | 'RUCKUS-SZ-SYSTEM-MIB' => 'ruckusSZSystemStatsSerialNumber', | ||
| 47 | 'RUCKUS-SCG-SYSTEM-MIB' => 'ruckusSystemStatsSerialNumber', | ||
| 48 | 'RUCKUS-CTRL-MIB' => 'ruckusCtrlSystemNodeModel', | ||
| 49 | ); | ||
| 50 | %GLOBALS = ( | ||
| 51 | %SNMP::Info::Layer3::GLOBALS, | ||
| 52 | |||
| 53 | # RUCKUS-SZ-SYSTEM-MIB | ||
| 54 | 'ruckus_sz_serial' => 'ruckusSZSystemStatsSerialNumber', | ||
| 55 | |||
| 56 | # RUCKUS-SCG-SYSTEM-MIB | ||
| 57 | 'ruckus_scg_serial' => 'ruckusSystemStatsSerialNumber', | ||
| 58 | ); | ||
| 59 | %FUNCS = ( | ||
| 60 | %SNMP::Info::Layer3::FUNCS, | ||
| 61 | |||
| 62 | # RUCKUS-CTRL-MIB::ruckusCTRLSystemNodeTable, one row per cluster node | ||
| 63 | 'ruckus_node_model' => 'ruckusCtrlSystemNodeModel', | ||
| 64 | 'ruckus_node_version' => 'ruckusCtrlSystemNodeVersion', | ||
| 65 | ); | ||
| 66 | %MUNGE = ( %SNMP::Info::Layer3::MUNGE ); | ||
| 67 | |||
| 68 | sub vendor { return 'ruckus'; } | ||
| 69 | |||
| 70 | # Some agents serve no sysServices; vSZ serves 78 | ||
| 71 | sub layers { | ||
| 72 | my $self = shift; | ||
| 73 | return $self->SUPER::layers() || '01001110'; | ||
| 74 | } | ||
| 75 | |||
| 76 | # A cluster serves a row per node, indexed by the node's serial as a | ||
| 77 | # length-prefixed string; some agents do not serve the serial column | ||
| 78 | sub _ruckus_node_iid { | ||
| 79 | my $self = shift; | ||
| 80 | |||
| 81 | my %iids = map { $_ => 1 } keys %{ $self->ruckus_node_model() || {} }, | ||
| 82 | keys %{ $self->ruckus_node_version() || {} }; | ||
| 83 | my $serial = $self->serial(); | ||
| 84 | if ( defined $serial ) { | ||
| 85 | my ($iid) = grep { _ruckus_iid_string($_) eq $serial } keys %iids; | ||
| 86 | return $iid if defined $iid; | ||
| 87 | } | ||
| 88 | my @iids = keys %iids; | ||
| 89 | return $iids[0] if @iids == 1; | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | |||
| 93 | sub _ruckus_iid_string { | ||
| 94 | my ( $length, @octets ) = split /\./, shift; | ||
| 95 | return '' unless defined $length and @octets == $length; | ||
| 96 | return join '', map {chr} @octets; | ||
| 97 | } | ||
| 98 | |||
| 99 | sub _ruckus_node_value { | ||
| 100 | my ( $self, $column ) = @_; | ||
| 101 | |||
| 102 | my $iid = $self->_ruckus_node_iid(); | ||
| 103 | return unless defined $iid; | ||
| 104 | my $value = ( $self->$column() || {} )->{$iid}; | ||
| 105 | return $value if defined $value and $value =~ /\S/; | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | |||
| 109 | sub os_ver { | ||
| 110 | my $self = shift; | ||
| 111 | return $self->_ruckus_node_value('ruckus_node_version') | ||
| 112 | || $self->SUPER::os_ver(); | ||
| 113 | } | ||
| 114 | |||
| 115 | sub model { | ||
| 116 | my $self = shift; | ||
| 117 | my $node_model = $self->_ruckus_node_value('ruckus_node_model'); | ||
| 118 | return $node_model if defined $node_model; | ||
| 119 | |||
| 120 | my $id = $self->id() || ''; | ||
| 121 | my $product = SNMP::translateObj($id) || ''; | ||
| 122 | return 'SCG200' if $product eq 'ruckusSCG200'; | ||
| 123 | return 'SZ100' if $product eq 'ruckusSZ100'; | ||
| 124 | return 'SZ50' if $product eq 'ruckusSZ50'; | ||
| 125 | return 'SCG' if $product eq 'ruckusWirelessSmartCellGatewayProducts'; | ||
| 126 | return 'SmartZone' if $product eq 'ruckusWirelessSmartZoneProducts'; | ||
| 127 | return $self->SUPER::model(); | ||
| 128 | } | ||
| 129 | |||
| 130 | sub serial { | ||
| 131 | my $self = shift; | ||
| 132 | my $serial = $self->ruckus_sz_serial(); | ||
| 133 | $serial = $self->ruckus_scg_serial() unless defined $serial && $serial =~ /\S/; | ||
| 134 | return $serial if defined $serial && $serial =~ /\S/; | ||
| 135 | return $self->SUPER::serial(); | ||
| 136 | } | ||
| 137 | |||
| 138 | sub os { return 'ruckus smartzone/scg'; } | ||
| 139 | |||
| 140 | 1; | ||
| 141 | |||
| 142 | __END__ |