1 # Copyright (C) 2004 Scott Brooks
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # Scott Brooks <sbrooks@binary-solutions.net>
19 # ATMEL based access points/bridges
21 package Torrus::DevDiscover::ATMEL;
27 $Torrus::DevDiscover::registry{'ATMEL'} = {
29 'checkdevtype' => \&checkdevtype,
30 'discover' => \&discover,
31 'buildConfig' => \&buildConfig
37 # Check to see if we can get the list of running WSS ports
38 'sysDeviceInfo' => '1.3.6.1.4.1.410.1.1.1.5.0',
39 'bridgeOperationalMode' => '1.3.6.1.4.1.410.1.1.4.1.0',
40 'operAccessPointName' => '1.3.6.1.4.1.410.1.2.1.10.0',
41 'bridgeRemoteBridgeBSSID' => '1.3.6.1.4.1.410.1.1.4.2.0'
48 my $devdetails = shift;
50 if( not $dd->checkSnmpOID('sysDeviceInfo') )
61 my $devdetails = shift;
63 my $data = $devdetails->data();
65 my $info = $dd->retrieveSnmpOIDs('sysDeviceInfo',
66 'operAccessPointName',
67 'bridgeOperationalMode',
68 'bridgeRemoteBridgeBSSID',
71 my $deviceInfo = substr($info->{'sysDeviceInfo'},2);
72 my $bridgeName = $info->{'operAccessPointName'};
74 #Get rid of all the nulls returned.
75 $bridgeName =~ s/\000//g;
77 $data->{'param'}{'comment'} = $bridgeName;
79 my $bridgeMode = $info->{'bridgeOperationalMode'};
81 my $remoteMac = substr($info->{'bridgeRemoteBridgeBSSID'},2);
83 $remoteMac =~ s/(\w\w)/$1-/g;
84 $remoteMac = substr($remoteMac,0,-1);
88 my ($version,$macaddr,$reserved,$regdomain,$producttype,$oemname,$oemid,
89 $productname,$hardwarerev) = unpack("LH12SLLA32LA32L",
90 pack("H*", $deviceInfo));
92 $macaddr =~ s/(\w\w)/$1-/g;
93 $macaddr = substr($macaddr,0,-1);
95 $data->{'param'}{'comment'} = $bridgeName;
97 if ($productname =~ m/airPoint/)
99 #we have an access point
100 if ($bridgeMode == 3)
102 #we have an access point in client bridge mode.
113 $devdetails->setCap('ATMEL::accessPoint');
115 "AP: " . $bridgeName .";" .
116 "Mac: " . $macaddr.";";
117 $data->{'param'}{'legend'} .= $legend;
123 "Bridge: " . $bridgeName .";" .
124 "Mac: " . $macaddr.";";
125 $data->{'param'}{'legend'} .= $legend;
127 $data->{'param'}{'legend'} .= "AP Mac: " . $remoteMac . ";";
129 #disable SNMP uptime check
130 $data->{'param'}{'snmp-check-sysuptime'} = 'no';
138 my $devdetails = shift;
142 my @templates = ('ATMEL::atmel-device-subtree');
144 if( $devdetails->hasCap('ATMEL::accessPoint') )
146 push (@templates, 'ATMEL::atmel-accesspoint-stats');
150 push (@templates, 'ATMEL::atmel-client-stats');
153 foreach my $tmpl ( @templates )
155 $cb->addTemplateApplication( $devNode, $tmpl );
165 # indent-tabs-mode: nil
166 # perl-indent-level: 4