4
unless(grep /blib/, @INC) {
6
@INC = '../lib' if -d '../lib';
11
BEGIN { plan tests => 9 }
13
use vars qw($agent_port $comm $agent_host);
14
require "t/startagent.pl";
17
my $junk_oid = ".1.3.6.1.2.1.1.1.1.1.1";
18
my $oid = '.1.3.6.1.2.1.1.1';
19
my $junk_name = 'fooDescr';
20
my $junk_host = 'no.host.here';
21
my $name = "gmarzot\@nortelnetworks.com";
24
my $n = 9; # Number of tests to run
27
#if ($n == 0) { exit 0; }
29
# create list of varbinds for GETS, val field can be null or omitted
30
my $vars = new SNMP::VarList (
31
['sysDescr', '0', ''],
42
############################## 1 #####################################
45
new SNMP::Session (DestHost=>$agent_host,Version=>1,Community=>$comm,RemotePort=>$agent_port);
48
############################# 2 #######################################
49
# Try getnext on sysDescr.0
51
my $next = $s1->getnext('sysDescr.0');
52
#print ("The next OID is : $next\n");
53
ok($s1->{ErrorStr} eq '');
54
#print STDERR "Error string1 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
57
########################### 3 ########################################
58
#$v1 = $s1->getnext('sysLocation.0');
59
#print ("The next OID is : $v1\n");
60
my $v2 = $s1->getnext('sysServices.0');
61
#print ("The next OID is : $v2\n");
62
ok($s1->{ErrorStr} eq '');
63
#print STDERR "Error string2 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
67
############################ 4 #######################################
68
# try it on an unknown OID
69
my $v3 = $s1->getnext('Srivathsan.0');
70
#print ("The unknown OID is : $v3\n");
71
ok($s1->{ErrorStr} =~ /^Unknown/);
72
#print STDERR "Error string5 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
74
############################# 5 #######################################
75
# On a non-accessible value
76
#my $kkk = $s1->getnext('vacmSecurityName.1');
77
#print("kkk is $kkk\n");
78
#ok($s1->{ErrorInd} != 0);
79
#print STDERR "Error string5 = $s1->{ErrorStr}:$s1->{ErrorInd}\n";
82
############################# 6 ####################################
83
# We should get back sysDescr.0 here.
84
my $var = new SNMP::Varbind(['sysDescr']);
85
my $res2 = $s1->getnext($var);
86
#print("res2 is : $res2\n");
87
ok((not $s1->{ErrorStr} and not $s1->{ErrorInd}));
88
ok((defined $var->iid and $var->iid eq 0));
89
ok((defined $var->val and $var->val eq $res2));
91
############################# 7 ######################################
92
# get the next one after that as well for a second check
93
my $res3 = $s1->getnext($var);
94
#print("res3 is : $res3\n");
95
ok((defined $var->tag and $var->tag eq 'sysObjectID'));
96
ok((defined $var->val and $var->val eq $res3));