net-snmp2 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/examples/agent.rb +1 -0
- data/examples/inform.rb +23 -0
- data/examples/trap_handler.rb +15 -0
- data/examples/{v1_trap_session.rb → v1_trap.rb} +2 -7
- data/examples/{v2_trap_session.rb → v2_trap.rb} +2 -7
- data/history.md +17 -0
- data/lib/net-snmp2.rb +1 -1
- data/lib/net/snmp/agent/agent.rb +44 -13
- data/lib/net/snmp/agent/provider.rb +56 -1
- data/lib/net/snmp/agent/provider_dsl.rb +11 -0
- data/lib/net/snmp/debug.rb +10 -19
- data/lib/net/snmp/error.rb +13 -6
- data/lib/net/snmp/listener.rb +2 -4
- data/lib/net/snmp/message.rb +52 -25
- data/lib/net/snmp/mib/mib.rb +2 -1
- data/lib/net/snmp/mib/node.rb +1 -1
- data/lib/net/snmp/oid.rb +5 -2
- data/lib/net/snmp/pdu.rb +15 -10
- data/lib/net/snmp/repl/manager_repl.rb +20 -7
- data/lib/net/snmp/session.rb +78 -45
- data/lib/net/snmp/trap_handler/trap_handler.rb +13 -9
- data/lib/net/snmp/trap_handler/v2_inform_dsl.rb +16 -0
- data/lib/net/snmp/trap_session.rb +64 -42
- data/lib/net/snmp/version.rb +1 -1
- data/lib/net/snmp/wrapper.rb +2 -8
- data/net-snmp2.gemspec +1 -1
- data/spec/README.md +36 -40
- data/spec/async_spec.rb +92 -87
- data/spec/em_spec.rb +3 -3
- data/spec/error_spec.rb +2 -2
- data/spec/fiber_spec.rb +8 -7
- data/spec/mib_spec.rb +8 -8
- data/spec/net-snmp_spec.rb +3 -3
- data/spec/oid_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -0
- data/spec/sync_spec.rb +50 -56
- data/spec/test_agent.rb +150 -0
- data/spec/test_mib.rb +6 -0
- data/spec/thread_spec.rb +4 -4
- data/spec/trap_spec.rb +3 -12
- data/spec/utility_spec.rb +4 -4
- data/spec/wrapper_spec.rb +6 -6
- metadata +11 -6
- data/lib/net/snmp/agent/request_dispatcher.rb +0 -38
data/spec/em_spec.rb
CHANGED
@@ -7,15 +7,15 @@ describe "em" do
|
|
7
7
|
EM.run do
|
8
8
|
Net::SNMP::Dispatcher.em_loop
|
9
9
|
|
10
|
-
session = Net::SNMP::Session.open(:peername => '
|
10
|
+
session = Net::SNMP::Session.open(:peername => 'localhost', :community => 'public') do |s|
|
11
11
|
s.get("sysDescr.0") do |op, result|
|
12
12
|
did_callback = true
|
13
|
-
result.varbinds[0].value.
|
13
|
+
expect(result.varbinds[0].value).to eq $test_mib['sysDescr.0']
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
EM.add_timer(3) do
|
18
|
-
did_callback.
|
18
|
+
expect(did_callback).to eq(true)
|
19
19
|
EM.stop
|
20
20
|
end
|
21
21
|
end
|
data/spec/error_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe "snmp errors" do
|
|
8
8
|
sess.get("sysDescr.0")
|
9
9
|
rescue Net::SNMP::Error => e
|
10
10
|
e.print
|
11
|
-
e.status.
|
11
|
+
expect(e.status).to eql(Net::SNMP::Constants::STAT_TIMEOUT)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -28,7 +28,7 @@ describe "snmp errors" do
|
|
28
28
|
EM.stop
|
29
29
|
}.resume(nil)
|
30
30
|
}
|
31
|
-
got_error.
|
31
|
+
expect(got_error).to eq(true)
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
data/spec/fiber_spec.rb
CHANGED
@@ -13,27 +13,28 @@ describe "in fiber" do
|
|
13
13
|
|
14
14
|
it "get should work in a fiber with synchronous calling style" do
|
15
15
|
wrap_fiber do
|
16
|
-
session = Net::SNMP::Session.open(:peername => '
|
16
|
+
session = Net::SNMP::Session.open(:peername => 'localhost', :community => 'public')
|
17
17
|
result = session.get("sysDescr.0")
|
18
|
-
result.varbinds[0].value.
|
18
|
+
expect(result.varbinds[0].value).to eq $test_mib["sysDescr.0"]
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it "getnext" do
|
23
23
|
wrap_fiber do
|
24
|
-
Net::SNMP::Session.open(:peername => "
|
24
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => "public" ) do |sess|
|
25
25
|
result = sess.get_next(["sysUpTimeInstance.0"])
|
26
|
-
result.varbinds.first.oid.oid.
|
27
|
-
result.varbinds.first.value.
|
26
|
+
expect(result.varbinds.first.oid.oid).to eq Net::SNMP::MIB.translate('sysContact.0')
|
27
|
+
expect(result.varbinds.first.value).to eq $test_mib['sysContact.0']
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should get using snmpv3" do
|
33
|
+
pending
|
33
34
|
wrap_fiber do
|
34
|
-
Net::SNMP::Session.open(:peername => '
|
35
|
+
Net::SNMP::Session.open(:peername => 'localhost', :version => 3, :username => 'MD5User', :security_level => Net::SNMP::Constants::SNMP_SEC_LEVEL_AUTHNOPRIV, :auth_protocol => :md5, :password => 'The Net-SNMP Demo Password') do |sess|
|
35
36
|
result = sess.get(["sysDescr.0"])
|
36
|
-
result.varbinds.first.value.
|
37
|
+
expect(result.varbinds.first.value).to eq $test_mib["sysDescr.0"]
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/spec/mib_spec.rb
CHANGED
@@ -14,12 +14,12 @@ describe Net::SNMP::MIB do
|
|
14
14
|
describe '::[]' do
|
15
15
|
it "can retrieve MIB nodes by variable name" do
|
16
16
|
node = Net::SNMP::MIB["sysDescr"]
|
17
|
-
node.label.
|
17
|
+
expect(node.label).to eq("sysDescr")
|
18
18
|
end
|
19
19
|
|
20
20
|
it "can retrieve MIB nodes by numeric oid" do
|
21
21
|
node = Net::SNMP::MIB["1.3.6.1.2.1.1.1"]
|
22
|
-
node.label.
|
22
|
+
expect(node.label).to eq("sysDescr")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -28,19 +28,19 @@ describe Net::SNMP::MIB::Node do
|
|
28
28
|
describe "::get_node" do
|
29
29
|
it "retrieves MIB nodes by variable name" do
|
30
30
|
node = Net::SNMP::MIB::Node.get_node("sysDescr")
|
31
|
-
node.label.
|
31
|
+
expect(node.label).to eq("sysDescr")
|
32
32
|
end
|
33
33
|
|
34
34
|
it "retrieves MIB nodes by numeric oid" do
|
35
35
|
node = Net::SNMP::MIB::Node.get_node("1.3.6.1.2.1.1.1")
|
36
|
-
node.label.
|
36
|
+
expect(node.label).to eq("sysDescr")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "#parent" do
|
41
41
|
it "links to the parent node" do
|
42
42
|
node = Net::SNMP::MIB::Node.get_node("sysDescr")
|
43
|
-
node.parent.label.
|
43
|
+
expect(node.parent.label).to eq("system")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -48,21 +48,21 @@ describe Net::SNMP::MIB::Node do
|
|
48
48
|
it "contains Node objects for all child nodes" do
|
49
49
|
node = Net::SNMP::MIB::Node.get_node("ifTable")
|
50
50
|
if_entry = node.children.first
|
51
|
-
if_entry.children.
|
51
|
+
expect(if_entry.children).to include { |n| n.label == "ifIndex" }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "#siblings" do
|
56
56
|
it "contains an array of sibling nodes" do
|
57
57
|
node = Net::SNMP::MIB::Node.get_node("sysDescr")
|
58
|
-
node.siblings.
|
58
|
+
expect(node.siblings).to include { |n| n.label == "sysName" }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "#oid" do
|
63
63
|
it "is an OID object for the node" do
|
64
64
|
node = Net::SNMP::MIB::Node.get_node("sysDescr")
|
65
|
-
node.oid.to_s.
|
65
|
+
expect(node.oid.to_s).to eq("1.3.6.1.2.1.1.1")
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
data/spec/net-snmp_spec.rb
CHANGED
@@ -7,9 +7,9 @@ describe "NetSnmp" do
|
|
7
7
|
# it "should get columns" do
|
8
8
|
# Net::SNMP::Session.open(:peername => 'localhost', :version => '2c', :community => 'public') do |sess|
|
9
9
|
# result = sess.get_columns(['ifIndex', 'ifInOctets', 'ifOutOctets'])
|
10
|
-
# result.size.
|
11
|
-
# result['1']['ifIndex'].
|
12
|
-
# result['2']['ifInOctets'].
|
10
|
+
# expect(result.size).to eql(7)
|
11
|
+
# expect(result['1']['ifIndex']).to eql('1')
|
12
|
+
# expect(result['2']['ifInOctets']).to be > 10
|
13
13
|
# end
|
14
14
|
# end
|
15
15
|
|
data/spec/oid_spec.rb
CHANGED
@@ -3,19 +3,19 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe Net::SNMP::OID do
|
4
4
|
it "should instantiate valid oid with numeric" do
|
5
5
|
oid = Net::SNMP::OID.new("1.3.6.1.2.1.2.1.0")
|
6
|
-
oid.to_s.
|
7
|
-
oid.label.
|
6
|
+
expect(oid.to_s).to eql("1.3.6.1.2.1.2.1.0")
|
7
|
+
expect(oid.label).to eql("ifNumber.0")
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should instantiate valid oid with string" do
|
11
11
|
oid = Net::SNMP::OID.new("ifNumber.0")
|
12
|
-
oid.to_s.
|
13
|
-
oid.label.
|
12
|
+
expect(oid.to_s).to eql("1.3.6.1.2.1.2.1.0")
|
13
|
+
expect(oid.label).to eql("ifNumber.0")
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should to_s correctly" do
|
17
17
|
oid_str = "1.3.6.1.2.1.2.1.0"
|
18
18
|
oid = Net::SNMP::OID.new(oid_str)
|
19
|
-
oid.to_s.
|
19
|
+
expect(oid.to_s).to eq(oid_str)
|
20
20
|
end
|
21
21
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,5 +6,10 @@ require 'rspec'
|
|
6
6
|
|
7
7
|
# Trap tests fail randomly due to race conditions,
|
8
8
|
# setting thread_safe should fix this
|
9
|
+
# Net::SNMP::Debug.logger = Logger.new(STDOUT)
|
10
|
+
# Net::SNMP::Debug.logger.level = Logger::INFO
|
9
11
|
Net::SNMP::thread_safe = true
|
10
12
|
Net::SNMP.init
|
13
|
+
|
14
|
+
# Must require after calling `SNMP.init`
|
15
|
+
require 'test_mib'
|
data/spec/sync_spec.rb
CHANGED
@@ -3,61 +3,61 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "synchronous calls" do
|
4
4
|
context "version 1" do
|
5
5
|
it "get should succeed" do
|
6
|
-
Net::SNMP::Session.open(:peername => "
|
6
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => "public" ) do |sess|
|
7
7
|
result = sess.get("sysDescr.0")
|
8
|
-
result.varbinds.first.value.
|
8
|
+
expect(result.varbinds.first.value).to eql($test_mib['sysDescr.0'])
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
it "multiple calls within session should succeed" do
|
13
|
-
Net::SNMP::Session.open(:peername => "
|
13
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => "public" ) do |sess|
|
14
14
|
result = sess.get("sysDescr.0")
|
15
|
-
result.varbinds.first.value.
|
15
|
+
expect(result.varbinds.first.value).to eql($test_mib['sysDescr.0'])
|
16
16
|
second = sess.get("sysName.0")
|
17
|
-
second.varbinds.first.value.
|
17
|
+
expect(second.varbinds.first.value).to eql($test_mib["sysName.0"])
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
it "get should succeed with multiple oids" do
|
22
|
-
Net::SNMP::Session.open(:peername => "
|
22
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => 'public' ) do |sess|
|
23
23
|
result = sess.get(["sysDescr.0", "sysName.0"])
|
24
|
-
result.varbinds[0].value.
|
25
|
-
result.varbinds[1].value.
|
24
|
+
expect(result.varbinds[0].value).to eql($test_mib['sysDescr.0'])
|
25
|
+
expect(result.varbinds[1].value).to eql($test_mib["sysName.0"])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it "set should succeed" do
|
30
30
|
Net::SNMP::Session.open(:peername => 'localhost', :version => 1, :community => 'private') do |sess|
|
31
31
|
result = sess.set([['sysContact.0', Net::SNMP::Constants::ASN_OCTET_STR, 'newContact']])
|
32
|
-
result.varbinds.first.value.
|
32
|
+
expect(result.varbinds.first.value).to match(/newContact/)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
it "getnext should succeed" do
|
37
|
-
Net::SNMP::Session.open(:peername => "
|
37
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => "public" ) do |sess|
|
38
38
|
result = sess.get_next(["sysUpTimeInstance.0"])
|
39
|
-
result.varbinds.first.oid.oid.
|
40
|
-
result.varbinds.first.value.
|
39
|
+
expect(result.varbinds.first.oid.oid).to eq Net::SNMP::MIB.translate('sysContact.0')
|
40
|
+
expect(result.varbinds.first.value).to eq $test_mib['sysContact.0']
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
it "getbulk should succeed" do
|
45
|
-
Net::SNMP::Session.open(:peername => "
|
45
|
+
Net::SNMP::Session.open(:peername => "localhost" , :version => '2c', :community => 'public') do |sess|
|
46
46
|
result = sess.get_bulk(["sysContact.0"], :max_repetitions => 10)
|
47
|
-
result.varbinds.first.oid.name.
|
48
|
-
result.varbinds.first.value.
|
47
|
+
expect(result.varbinds.first.oid.name).to eql("1.3.6.1.2.1.1.5.0")
|
48
|
+
expect(result.varbinds.first.value).to eql($test_mib["sysName.0"])
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
it "getbulk should succeed with multiple oids" do
|
53
53
|
Net::SNMP::Session.open(:peername => "localhost" , :version => '2c', :community => 'public') do |sess|
|
54
54
|
result = sess.get_bulk(["ifIndex", "ifType"], :max_repetitions =>3)
|
55
|
-
result.varbinds.size.
|
55
|
+
expect(result.varbinds.size).to eql(6)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
it "rasises an when a non-existant MIB variable is requested" do
|
60
|
-
Net::SNMP::Session.open(:peername => "
|
60
|
+
Net::SNMP::Session.open(:peername => "localhost", :community => "public" ) do |sess|
|
61
61
|
expect { sess.get(["XXXsysDescr.0"]) }.to raise_error
|
62
62
|
end
|
63
63
|
end
|
@@ -65,23 +65,21 @@ describe "synchronous calls" do
|
|
65
65
|
it "get_table should work" do
|
66
66
|
session = Net::SNMP::Session.open(:peername => "localhost", :version => '1')
|
67
67
|
table = session.table("ifEntry")
|
68
|
-
table['1']['ifIndex'].
|
69
|
-
table['2']['ifIndex'].
|
68
|
+
expect(table['1']['ifIndex']).to eql(1)
|
69
|
+
expect(table['2']['ifIndex']).to eql(2)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "walk should work" do
|
73
|
-
session = Net::SNMP::Session.open(:peername => '
|
73
|
+
session = Net::SNMP::Session.open(:peername => 'localhost', :version => 1, :community => 'public')
|
74
74
|
results = session.walk("system")
|
75
|
-
results['
|
75
|
+
expect(results[Net::SNMP::MIB.translate('sysDescr.0')]).to eq($test_mib["sysDescr.0"])
|
76
76
|
end
|
77
77
|
|
78
78
|
it "walk should work with multiple oids" do
|
79
79
|
Net::SNMP::Session.open(:peername => 'localhost', :version => 1) do |sess|
|
80
80
|
sess.walk(['system', 'ifTable']) do |results|
|
81
|
-
|
82
|
-
results[
|
83
|
-
# ifIndex (Should just be returning the same number as the instance requested)
|
84
|
-
results['1.3.6.1.2.1.2.2.1.1.2'].should eql(2)
|
81
|
+
expect(results[Net::SNMP::MIB.translate('sysContact.0')]).to eq $test_mib['sysContact.0']
|
82
|
+
expect(results[Net::SNMP::MIB.translate("ifIndex.2")]).to eql(2)
|
85
83
|
end
|
86
84
|
end
|
87
85
|
end
|
@@ -89,44 +87,40 @@ describe "synchronous calls" do
|
|
89
87
|
it "get_columns should work" do
|
90
88
|
Net::SNMP::Session.open(:peername => 'localhost') do |sess|
|
91
89
|
table = sess.columns(['ifIndex', 'ifDescr', 'ifType'])
|
92
|
-
table['1']['ifIndex'].
|
93
|
-
table['2']['ifDescr'].should match(/[a-zA-Z]{3}[0-9]/)
|
90
|
+
expect(table['1']['ifIndex']).to eql(1)
|
94
91
|
end
|
95
92
|
end
|
96
93
|
|
97
94
|
it "get a value with oid type should work" do
|
98
|
-
Net::SNMP::Session.open(:peername => '
|
95
|
+
Net::SNMP::Session.open(:peername => 'localhost', :community => 'public') do |sess|
|
99
96
|
res = sess.get("sysObjectID.0")
|
100
|
-
res.varbinds.first.value.to_s.
|
97
|
+
expect(res.varbinds.first.value.to_s).to eq $test_mib['sysObjectID.0'].to_s
|
101
98
|
end
|
102
99
|
end
|
103
100
|
end
|
104
101
|
|
105
|
-
context "version
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
102
|
+
# context "version 3" do
|
103
|
+
# it "should get using snmpv3" do
|
104
|
+
# pending
|
105
|
+
# Net::SNMP::Session.open(:peername => 'localhost', :version => 3, :username => 'MD5User', :security_level => Net::SNMP::Constants::SNMP_SEC_LEVEL_AUTHNOPRIV, :auth_protocol => :md5, :password => 'The Net-SNMP Demo Password') do |sess|
|
106
|
+
# result = sess.get("sysDescr.0")
|
107
|
+
# expect(result.varbinds.first.value).to eql($test_mib['sysDescr.0'])
|
108
|
+
# end
|
109
|
+
# end
|
110
|
+
# it "should set using snmpv3" do
|
111
|
+
# pending
|
112
|
+
# Net::SNMP::Session.open(:peername => 'localhost', :version => 3, :username => 'myuser', :auth_protocol => :sha1, :password => '0x1234') do |sess|
|
113
|
+
# result = sess.set([["sysDescr.0", Net::SNMP::Constants::ASN_OCTET_STR, 'yomama']])
|
114
|
+
# expect(result.varbinds.first.value).to match(/Darwin/)
|
115
|
+
# end
|
116
|
+
# end
|
117
|
+
#
|
118
|
+
# it "should get using authpriv" do
|
119
|
+
# pending
|
120
|
+
# Net::SNMP::Session.open(:peername => 'localhost', :version => 3, :username => 'mixtli', :security_level => Net::SNMP::Constants::SNMP_SEC_LEVEL_AUTHPRIV, :auth_protocol => :md5, :priv_protocol => :des, :auth_password => 'testauth', :priv_password => 'testpass') do |sess|
|
121
|
+
# result = sess.get("sysDescr.0")
|
122
|
+
# expect(result.varbinds.first.value).to match(/xenu/)
|
123
|
+
# end
|
124
|
+
# end
|
125
|
+
# end
|
132
126
|
end
|
data/spec/test_agent.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
require_relative "./spec_helper"
|
2
|
+
|
3
|
+
include Net::SNMP
|
4
|
+
include Net::SNMP::Debug
|
5
|
+
|
6
|
+
$test_agent = Agent.new
|
7
|
+
|
8
|
+
$test_agent.provide do
|
9
|
+
get do
|
10
|
+
info "GET #{variable}"
|
11
|
+
if $test_mib.has_key? variable
|
12
|
+
reply $test_mib[variable]
|
13
|
+
else
|
14
|
+
info "No such object"
|
15
|
+
no_such_object
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
get_next do
|
20
|
+
info "GETNEXT #{variable}"
|
21
|
+
# TODO: Get rid of this nasty case statement (Use the mib to determine the next value)
|
22
|
+
case variable
|
23
|
+
when 'system'
|
24
|
+
reply oid: 'sysDescr.0', value: $test_mib['sysDescr.0']
|
25
|
+
when 'sysDescr'
|
26
|
+
reply oid: 'sysDescr.0', value: $test_mib['sysDescr.0']
|
27
|
+
when 'sysDescr.0'
|
28
|
+
reply oid: 'sysUpTimeInstance.0', value: $test_mib['sysUpTimeInstance.0']
|
29
|
+
when 'sysUpTimeInstance.0'
|
30
|
+
reply oid: 'sysContact.0', value: $test_mib['sysContact.0']
|
31
|
+
when 'sysContact'
|
32
|
+
reply oid: 'sysContact.0', value: $test_mib['sysContact.0']
|
33
|
+
when 'sysContact.0'
|
34
|
+
reply oid: 'sysName.0', value: $test_mib['sysName.0']
|
35
|
+
when 'ifTable'
|
36
|
+
reply oid: 'ifSpecific.1', value: 1
|
37
|
+
when 'ifSpecific'
|
38
|
+
reply oid: 'ifSpecific.1', value: 'stub'
|
39
|
+
when 'ifSpecific.1'
|
40
|
+
reply oid: 'ifOutQLen.1', value: 'stub'
|
41
|
+
when 'ifOutQLen'
|
42
|
+
reply oid: 'ifOutQLen.1', value: 'stub'
|
43
|
+
when 'ifOutQLen.1'
|
44
|
+
reply oid: 'ifOutErrors.1', value: 'stub'
|
45
|
+
when 'ifOutErrors'
|
46
|
+
reply oid: 'ifOutErrors.1', value: 'stub'
|
47
|
+
when 'ifOutErrors.1'
|
48
|
+
reply oid: 'ifOutDiscards.1', value: 'stub'
|
49
|
+
when 'ifOutDiscards'
|
50
|
+
reply oid: 'ifOutDiscards.1', value: 'stub'
|
51
|
+
when 'ifOutDiscards.1'
|
52
|
+
reply oid: 'ifOutNUcastPkts.1', value: 'stub'
|
53
|
+
when 'ifOutNUcastPkts'
|
54
|
+
reply oid: 'ifOutNUcastPkts.1', value: 'stub'
|
55
|
+
when 'ifOutNUcastPkts.1'
|
56
|
+
reply oid: 'ifOutUcastPkts.1', value: 'stub'
|
57
|
+
when 'ifOutUcastPkts'
|
58
|
+
reply oid: 'ifOutUcastPkts.1', value: 'stub'
|
59
|
+
when 'ifOutUcastPkts.1'
|
60
|
+
reply oid: 'ifOutOctets.1', value: 'stub'
|
61
|
+
when 'ifOutOctets'
|
62
|
+
reply oid: 'ifOutOctets.1', value: 'stub'
|
63
|
+
when 'ifOutOctets.1'
|
64
|
+
reply oid: 'ifInUnknownProtos.1', value: 'stub'
|
65
|
+
when 'ifInUnknownProtos'
|
66
|
+
reply oid: 'ifInUnknownProtos.1', value: 'stub'
|
67
|
+
when 'ifInUnknownProtos.1'
|
68
|
+
reply oid: 'ifInErrors.1', value: 'stub'
|
69
|
+
when 'ifInErrors'
|
70
|
+
reply oid: 'ifInErrors.1', value: 'stub'
|
71
|
+
when 'ifInErrors.1'
|
72
|
+
reply oid: 'ifInDiscards.1', value: 'stub'
|
73
|
+
when 'ifInDiscards'
|
74
|
+
reply oid: 'ifInDiscards.1', value: 'stub'
|
75
|
+
when 'ifInDiscards.1'
|
76
|
+
reply oid: 'ifInNUcastPkts.1', value: 'stub'
|
77
|
+
when 'ifInNUcastPkts'
|
78
|
+
reply oid: 'ifInNUcastPkts.1', value: 'stub'
|
79
|
+
when 'ifInNUcastPkts.1'
|
80
|
+
reply oid: 'ifInUcastPkts.1', value: 'stub'
|
81
|
+
when 'ifInUcastPkts'
|
82
|
+
reply oid: 'ifInUcastPkts.1', value: 'stub'
|
83
|
+
when 'ifInUcastPkts.1'
|
84
|
+
reply oid: 'ifInOctets.1', value: 'stub'
|
85
|
+
when 'ifInOctets'
|
86
|
+
reply oid: 'ifInOctets.1', value: 'stub'
|
87
|
+
when 'ifInOctets.1'
|
88
|
+
reply oid: 'ifLastChange.1', value: 'stub'
|
89
|
+
when 'ifLastChange'
|
90
|
+
reply oid: 'ifLastChange.1', value: 'stub'
|
91
|
+
when 'ifLastChange.1'
|
92
|
+
reply oid: 'ifOperStatus.1', value: 'stub'
|
93
|
+
when 'ifOperStatus'
|
94
|
+
reply oid: 'ifOperStatus.1', value: 'stub'
|
95
|
+
when 'ifOperStatus.1'
|
96
|
+
reply oid: 'ifAdminStatus.1', value: 'stub'
|
97
|
+
when 'ifAdminStatus'
|
98
|
+
reply oid: 'ifAdminStatus.1', value: 'stub'
|
99
|
+
when 'ifAdminStatus.1'
|
100
|
+
reply oid: 'ifPhysAddress.1', value: 'stub'
|
101
|
+
when 'ifPhysAddress'
|
102
|
+
reply oid: 'ifPhysAddress.1', value: 'stub'
|
103
|
+
when 'ifPhysAddress.1'
|
104
|
+
reply oid: 'ifSpeed.1', value: 'stub'
|
105
|
+
when 'ifSpeed'
|
106
|
+
reply oid: 'ifSpeed.1', value: 'stub'
|
107
|
+
when 'ifSpeed.1'
|
108
|
+
reply oid: 'ifMtu.1', value: 'stub'
|
109
|
+
when 'ifMtu'
|
110
|
+
reply oid: 'ifMtu.1', value: 'stub'
|
111
|
+
when 'ifMtu.1'
|
112
|
+
reply oid: 'ifType.1', value: 'stub'
|
113
|
+
when 'ifType'
|
114
|
+
reply oid: 'ifType.1', value: 'stub'
|
115
|
+
when 'ifType.1'
|
116
|
+
reply oid: 'ifDescr.1', value: 'stub'
|
117
|
+
when 'ifDescr'
|
118
|
+
reply oid: 'ifDescr.1', value: 'stub'
|
119
|
+
when 'ifDescr.1'
|
120
|
+
reply oid: 'ifIndex.1', value: 1
|
121
|
+
when 'ifIndex'
|
122
|
+
reply oid: 'ifIndex.1', value: 1
|
123
|
+
when 'ifIndex.1'
|
124
|
+
reply oid: 'ifIndex.2', value: 2
|
125
|
+
else
|
126
|
+
end_of_mib
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
get_bulk do
|
131
|
+
info "GETBULK #{variable}"
|
132
|
+
case variable
|
133
|
+
when 'sysContact.0'
|
134
|
+
add oid: 'sysName.0', value: $test_mib['sysName.0']
|
135
|
+
else
|
136
|
+
max_repetitions.times do
|
137
|
+
echo
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
set do
|
143
|
+
info "SET #{variable} = #{value}"
|
144
|
+
# Not actually going to set the variable in $test_mib
|
145
|
+
# so that the tests don't depend on each other.
|
146
|
+
ok
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
$test_agent.start
|