default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / torrus / perllib / Torrus / DevDiscover / RFC1657_BGP4_MIB.pm
1 #  Copyright (C) 2005  Stanislav Sinyagin
2 #
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.
7 #
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.
12 #
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.
16
17 # $Id: RFC1657_BGP4_MIB.pm,v 1.1 2010-12-27 00:03:54 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19
20 # Discovery module for BGP4-MIB (RFC 1657)
21 # This module does not generate any XML, but provides information
22 # for other discovery modules. For the sake of discovery time and traffic,
23 # it is not implicitly executed during the normal discovery process.
24
25 package Torrus::DevDiscover::RFC1657_BGP4_MIB;
26
27 use strict;
28 use Torrus::Log;
29
30
31 our %oiddef =
32     (
33      # BGP4-MIB
34      'bgpPeerRemoteAs'       => '1.3.6.1.2.1.15.3.1.9',
35      );
36
37
38
39
40 sub discover
41 {
42     my $dd = shift;
43     my $devdetails = shift;
44
45     my $data = $devdetails->data();
46     my $session = $dd->session();
47
48     my $table = $session->get_table( -baseoid =>
49                                      $dd->oiddef('bgpPeerRemoteAs'));
50     
51     if( not defined( $table ) or scalar( %{$table} ) == 0 )
52     {
53         return 0;
54     }
55     
56     $devdetails->storeSnmpVars( $table );
57     $devdetails->setCap('bgpPeerTable');
58
59
60     foreach my $INDEX
61         ( $devdetails->
62           getSnmpIndices( $dd->oiddef('bgpPeerRemoteAs') ) )
63     {
64         my $ipAddr = $INDEX;
65
66         my $asNum =
67             $devdetails->snmpVar($dd->oiddef('bgpPeerRemoteAs') .
68                                  '.' . $INDEX);
69
70         $data->{'bgpPeerAS'}{$ipAddr} = $asNum;
71     }
72                             
73     return 1;
74 }
75
76
77
78 1;
79
80
81 # Local Variables:
82 # mode: perl
83 # indent-tabs-mode: nil
84 # perl-indent-level: 4
85 # End: