and added files
[bcm963xx.git] / userapps / opensource / net-snmp / perl / SNMP / t / mibload.t
1 #!./perl
2
3 BEGIN {
4     unless(grep /blib/, @INC) {
5         chdir 't' if -d 't';
6         @INC = '../lib' if -d '../lib';
7     }
8 }
9
10 use Test;
11 BEGIN {plan tests => 7}
12 use SNMP;
13
14 require "t/startagent.pl";
15
16 use vars qw($mibdir);
17
18 $SNMP::verbose = 0;
19
20 my $mib_file = 't/mib.txt';
21 my $junk_mib_file = 'mib.txt';
22 my $mibfile1 = "$mibdir/TCP-MIB.txt";
23 my @mibdir = ("$mibdir");
24 my $mibfile2 = "$mibdir/IPV6-TCP-MIB.txt";
25
26 ######################################################################
27 # See if we can find a mib to use, return of 0 means the file wasn't
28 # found or isn't readable.
29
30 $res = SNMP::setMib($junk_mib_file,1);
31 ok(defined(!$res));
32 ######################################################################
33 # Now we give the right name
34
35 $res = SNMP::setMib($mib_file,1);
36 ok(defined($res));
37 ######################################################################
38 # See if we can find a mib to use
39
40 $res = SNMP::setMib($mib_file,0);
41 ok(defined($res));
42 ######################## 4 ################################
43 # add a mib dir
44
45 $res = SNMP::addMibDirs($mibdir[0]);
46
47 SNMP::loadModules("IP-MIB", "IF-MIB", "IANAifType-MIB", "RFC1213-MIB");
48 #SNMP::unloadModules(RMON-MIB);
49 #etherStatsDataSource shouldn't be found.
50 #present only in 1271 & RMON-MIB.
51 $res = $SNMP::MIB{etherStatsDataSource};
52
53 ok(!defined($res));
54
55 ########################  5  ############################
56 # add mib file
57
58 $res1 = SNMP::addMibFiles($mibfile1);
59 ok(defined($res1));
60 $res2 = SNMP::addMibFiles($mibfile2);
61 ok(defined($res2));
62
63 $res = $SNMP::MIB{ipv6TcpConnState}{moduleID};
64
65 ok($res =~ /^IPV6-TCP-MIB/);
66 #################################################
67
68