forked from gitpan/SNMP-MIB-Compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mibcompiler
executable file
·48 lines (34 loc) · 1.09 KB
/
mibcompiler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl -w
BEGIN { unshift @INC, "lib" }
use strict;
use SNMP::MIB::Compiler;
use Data::Dumper;
my $DATE = '1999/05/06';
my $outdir = 'out';
my $file = shift || die "Usage: $0 MIBNAME\n";
$Data::Dumper::Purity = 1;
$Data::Dumper::Indent = 1;
$Data::Dumper::Terse = 1;
my $mib = new SNMP::MIB::Compiler;
$mib->add_path('mibs', 'mibs/cisco', 'mibs/com21',
'/home/ftp/doc/mibs/ascend');
$mib->add_extension('', '.mib', '.my');
mkdir $outdir, oct 755 unless -d $outdir;
$mib->repository($outdir);
$mib->{'accept_smiv1'} = 1;
$mib->{'accept_smiv2'} = 1;
$mib->{'debug_recursive'} = 1;
$mib->{'debug_lexer'} = 0;
$mib->{'make_dump'} = 1;
$mib->{'use_dump'} = 1;
$mib->{'do_imports'} = 1;
$mib->{'allow_underscore'} = 1;
$mib->load($file) || $mib->compile($file);
# my $node = 'snmpEnableAuthenTraps';
# my $oid = $mib->resolve_oid($node);
# print "$node => $oid\n";
# print "$oid => ", $mib->convert_oid($oid), "\n\n";
# $mib->load('SNMPv2-SMI');
# print $mib->resolve_oid('ifInOctets'), "\n";
# print $mib->convert_oid('1.3.6.1.2.1.31.1.1.1.10'), "\n";
# print $mib->tree('ifMIB');