netsnmp 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +4 -4
- data/Gemfile +5 -1
- data/README.md +124 -63
- data/lib/netsnmp.rb +66 -10
- data/lib/netsnmp/client.rb +93 -75
- data/lib/netsnmp/encryption/aes.rb +84 -0
- data/lib/netsnmp/encryption/des.rb +80 -0
- data/lib/netsnmp/encryption/none.rb +17 -0
- data/lib/netsnmp/errors.rb +1 -3
- data/lib/netsnmp/message.rb +81 -0
- data/lib/netsnmp/oid.rb +18 -137
- data/lib/netsnmp/pdu.rb +106 -64
- data/lib/netsnmp/scoped_pdu.rb +23 -0
- data/lib/netsnmp/security_parameters.rb +198 -0
- data/lib/netsnmp/session.rb +84 -275
- data/lib/netsnmp/v3_session.rb +81 -0
- data/lib/netsnmp/varbind.rb +65 -156
- data/lib/netsnmp/version.rb +2 -1
- data/netsnmp.gemspec +2 -8
- data/spec/client_spec.rb +147 -99
- data/spec/handlers/celluloid_spec.rb +33 -20
- data/spec/oid_spec.rb +11 -5
- data/spec/pdu_spec.rb +22 -22
- data/spec/security_parameters_spec.rb +40 -0
- data/spec/session_spec.rb +0 -23
- data/spec/support/celluloid.rb +24 -0
- data/spec/support/request_examples.rb +36 -0
- data/spec/support/start_docker.sh +15 -1
- data/spec/v3_session_spec.rb +21 -0
- data/spec/varbind_spec.rb +2 -51
- metadata +30 -76
- data/lib/netsnmp/core.rb +0 -12
- data/lib/netsnmp/core/client.rb +0 -15
- data/lib/netsnmp/core/constants.rb +0 -153
- data/lib/netsnmp/core/inline.rb +0 -20
- data/lib/netsnmp/core/libc.rb +0 -48
- data/lib/netsnmp/core/libsnmp.rb +0 -44
- data/lib/netsnmp/core/structures.rb +0 -167
- data/lib/netsnmp/core/utilities.rb +0 -13
- data/lib/netsnmp/handlers/celluloid.rb +0 -27
- data/lib/netsnmp/handlers/em.rb +0 -56
- data/spec/core/libc_spec.rb +0 -2
- data/spec/core/libsnmp_spec.rb +0 -32
- data/spec/core/structures_spec.rb +0 -54
- data/spec/handlers/em_client_spec.rb +0 -34
@@ -1,29 +1,42 @@
|
|
1
1
|
require 'celluloid/io'
|
2
|
-
|
2
|
+
require_relative "../support/request_examples"
|
3
3
|
require_relative '../support/celluloid'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe "with cellulloid", type: :celluloid do
|
6
6
|
include CelluloidHelpers
|
7
|
-
let(:
|
8
|
-
|
9
|
-
|
10
|
-
port: SNMPPORT,
|
11
|
-
username: "simulator",
|
12
|
-
auth_password: "auctoritas",
|
13
|
-
auth_protocol: :md5,
|
14
|
-
priv_password: "privatus",
|
15
|
-
priv_protocol: :des
|
16
|
-
} }
|
7
|
+
let(:user_options) { { username: "authprivmd5des", auth_password: "maplesyrup",
|
8
|
+
auth_protocol: :md5, priv_password: "maplesyrup",
|
9
|
+
priv_protocol: :des } }
|
17
10
|
|
18
|
-
|
11
|
+
let(:get_oid) { "1.3.6.1.2.1.1.5.0" }
|
12
|
+
let(:next_oid) { "1.3.6.1.2.1.1.6.0" }
|
13
|
+
let(:set_oid) { "1.3.6.1.2.1.1.3.0" } # sysUpTimeInstance
|
14
|
+
let(:walk_oid) { "1.3.6.1.2.1.1.9.1.3" }
|
15
|
+
let(:get_result) { "tt" }
|
16
|
+
let(:next_result) { "KK12" }
|
17
|
+
let(:walk_result) { <<-WALK
|
18
|
+
1.3.6.1.2.1.1.9.1.3.1: The SNMP Management Architecture MIB.
|
19
|
+
1.3.6.1.2.1.1.9.1.3.2: The MIB for Message Processing and Dispatching.
|
20
|
+
1.3.6.1.2.1.1.9.1.3.3: The management information definitions for the SNMP User-based Security Model.
|
21
|
+
1.3.6.1.2.1.1.9.1.3.4: The MIB module for SNMPv2 entities
|
22
|
+
1.3.6.1.2.1.1.9.1.3.5: The MIB module for managing TCP implementations
|
23
|
+
1.3.6.1.2.1.1.9.1.3.6: The MIB module for managing IP and ICMP implementations
|
24
|
+
1.3.6.1.2.1.1.9.1.3.7: The MIB module for managing UDP implementations
|
25
|
+
1.3.6.1.2.1.1.9.1.3.8: View-based Access Control Model for SNMP.
|
26
|
+
WALK
|
27
|
+
}
|
19
28
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
29
|
+
around(:each) do |example|
|
30
|
+
within_io_actor { example.run }
|
31
|
+
end
|
32
|
+
let(:proxy) { CelluloidHelpers::Proxy.new("localhost", SNMPPORT) }
|
33
|
+
after(:each) { proxy.close }
|
34
|
+
|
35
|
+
it_behaves_like "an snmp client" do
|
36
|
+
subject { NETSNMP::Client.new(options) }
|
37
|
+
let(:device_options) { { proxy: proxy } }
|
38
|
+
let(:protocol_options) { user_options }
|
39
|
+
let(:extra_options) { { version: 3, context: "a172334d7d97871b72241397f713fa12" } }
|
27
40
|
end
|
28
41
|
|
29
42
|
end
|
data/spec/oid_spec.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
RSpec.describe NETSNMP::OID do
|
2
|
-
let(:code) { "SNMPv2-MIB::sysDescr.0" }
|
3
|
-
let(:
|
4
|
-
subject { described_class.
|
2
|
+
#let(:code) { "SNMPv2-MIB::sysDescr.0" }
|
3
|
+
let(:code) { "1.3.6.1.2.1.1.1.0" }
|
4
|
+
subject { described_class.build(code) }
|
5
|
+
|
6
|
+
describe ".build" do
|
7
|
+
it { expect(described_class.build([1,3,6,1,2,1,1,1,0]).to_s).to eq(code) }
|
8
|
+
it { expect(described_class.build(".#{code}").to_s).to eq(code) }
|
9
|
+
it { expect { described_class.build("blablabla") }.to raise_error(NETSNMP::Error) }
|
10
|
+
end
|
5
11
|
|
6
|
-
|
7
|
-
expect(subject.
|
12
|
+
describe ".to_asn" do
|
13
|
+
it { expect(described_class.to_asn(subject).to_der).to eq("\x06\b+\x06\x01\x02\x01\x01\x01\x00".b) }
|
8
14
|
end
|
9
15
|
end
|
data/spec/pdu_spec.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
RSpec.describe NETSNMP::PDU do
|
2
|
-
let(:
|
3
|
-
let(:
|
4
|
-
|
5
|
-
before do
|
6
|
-
allow(NETSNMP::Core::Structures::PDU).to receive(:new).with(pointer).and_return(struct)
|
7
|
-
end
|
8
|
-
|
9
|
-
it { is_expected.to respond_to(:struct) }
|
10
|
-
it { expect(subject.varbinds).to be_empty }
|
2
|
+
let(:get_request_oid) { ".1.3.6.1.2.1.1.1.0" }
|
3
|
+
let(:encoded_get_pdu) { "0'\002\001\000\004\006public\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000" }
|
4
|
+
let(:encoded_response_pdu) { "0+\002\001\000\004\006public\242\036\002\002'\017\002\001\000\002\001\0000\0220\020\006\b+\006\001\002\001\001\001\000\004\004test" }
|
11
5
|
|
12
|
-
describe
|
13
|
-
|
14
|
-
|
6
|
+
describe "#to_der" do
|
7
|
+
let(:pdu_get){ described_class.build(:get,
|
8
|
+
headers: [0, "public"] ,
|
9
|
+
request_id: 16170) }
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
let(:varbind) { double(:varbind) }
|
20
|
-
before { allow(NETSNMP::RequestVarbind).to receive(:new).with(subject, oid, value, instance_of(Hash)).and_return(varbind) }
|
21
|
-
it "creates a new varbind and adds it to the structure" do
|
22
|
-
subject.add_varbind(oid, { value: value })
|
23
|
-
expect(subject.varbinds).not_to be_empty
|
24
|
-
expect(subject.varbinds).to include(varbind)
|
25
|
-
end
|
11
|
+
context "v1" do
|
12
|
+
before { pdu_get.add_varbind(oid: get_request_oid) }
|
13
|
+
it { expect(pdu_get.to_der).to eq(encoded_get_pdu.b) }
|
26
14
|
end
|
27
15
|
end
|
28
16
|
|
17
|
+
describe "#decoding pdus" do
|
18
|
+
describe "v1" do
|
19
|
+
let(:pdu_response) { described_class.decode(encoded_response_pdu) }
|
20
|
+
it { expect(pdu_response.version).to be(0) }
|
21
|
+
it { expect(pdu_response.community).to eq("public") }
|
22
|
+
it { expect(pdu_response.request_id).to be(9999) }
|
23
|
+
|
24
|
+
it { expect(pdu_response.varbinds.length).to be(1) }
|
25
|
+
it { expect(pdu_response.varbinds[0].oid).to eq("1.3.6.1.2.1.1.1.0") }
|
26
|
+
it { expect(pdu_response.varbinds[0].value).to eq("test") }
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# FROM https://tools.ietf.org/html/rfc3414#appendix-A.2.1
|
2
|
+
RSpec.describe NETSNMP::SecurityParameters do
|
3
|
+
let(:engine_id) {"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02".b }
|
4
|
+
let(:password) { "maplesyrup" }
|
5
|
+
describe "#passkey" do
|
6
|
+
context "md5" do
|
7
|
+
subject { described_class.new(security_level: :auth_no_priv, auth_protocol: :md5, username: "username", engine_id: engine_id, auth_password: "maplesyrup" ) }
|
8
|
+
it { expect(subject.send(:passkey, password)).to eq("\x9f\xaf\x32\x83\x88\x4e\x92\x83\x4e\xbc\x98\x47\xd8\xed\xd9\x63".b) }
|
9
|
+
end
|
10
|
+
context "sha" do
|
11
|
+
subject { described_class.new(security_level: :auth_priv, auth_protocol: :sha, username: "username", engine_id: engine_id, auth_password: "maplesyrup", priv_password: "maplesyrup") }
|
12
|
+
it { expect(subject.send(:passkey, password).b).to eq("\x9f\xb5\xcc\x03\x81\x49\x7b\x37\x93\x52\x89\x39\xff\x78\x8d\x5d\x79\x14\x52\x11".b) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
describe "keys" do
|
18
|
+
let(:md5_sec) { described_class.new(security_level: :auth_priv,
|
19
|
+
auth_protocol: :md5,
|
20
|
+
priv_protocol: :des,
|
21
|
+
username: "username",
|
22
|
+
auth_password: password,
|
23
|
+
priv_password: password,
|
24
|
+
engine_id: engine_id ) }
|
25
|
+
let(:sha_sec) { described_class.new(security_level: :auth_priv,
|
26
|
+
auth_protocol: :sha,
|
27
|
+
priv_protocol: :des,
|
28
|
+
username: "username",
|
29
|
+
auth_password: password,
|
30
|
+
priv_password: password,
|
31
|
+
engine_id: engine_id ) }
|
32
|
+
it do
|
33
|
+
expect(md5_sec.send(:auth_key)).to eq("\x52\x6f\x5e\xed\x9f\xcc\xe2\x6f\x89\x64\xc2\x93\x07\x87\xd8\x2b".b)
|
34
|
+
expect(md5_sec.send(:priv_key)).to eq("\x52\x6f\x5e\xed\x9f\xcc\xe2\x6f\x89\x64\xc2\x93\x07\x87\xd8\x2b".b)
|
35
|
+
expect(sha_sec.send(:auth_key)).to eq("\x66\x95\xfe\xbc\x92\x88\xe3\x62\x82\x23\x5f\xc7\x15\x1f\x12\x84\x97\xb3\x8f\x3f".b)
|
36
|
+
expect(sha_sec.send(:priv_key)).to eq("\x66\x95\xfe\xbc\x92\x88\xe3\x62\x82\x23\x5f\xc7\x15\x1f\x12\x84\x97\xb3\x8f\x3f".b)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/spec/session_spec.rb
CHANGED
@@ -8,27 +8,4 @@ RSpec.describe NETSNMP::Session do
|
|
8
8
|
subject { described_class.new(host, options) }
|
9
9
|
after { subject.close }
|
10
10
|
|
11
|
-
|
12
|
-
describe "#send" do
|
13
|
-
let(:pointer) { double(:pointer) }
|
14
|
-
let(:pdu) { double(:pdu, pointer: pointer) }
|
15
|
-
let(:response) { double(:response) }
|
16
|
-
let(:reqid) { double(:requestid) }
|
17
|
-
let(:requests) { {} }
|
18
|
-
|
19
|
-
before do
|
20
|
-
allow(pdu).to receive(:[]).with(:reqid).and_return(reqid)
|
21
|
-
allow(requests).to receive(:[]).with(reqid).and_return([:success, response])
|
22
|
-
end
|
23
|
-
|
24
|
-
it "sends and receives a pdu" do
|
25
|
-
expect(IO).to receive(:select).twice.and_return([[], []])
|
26
|
-
expect(NETSNMP::Core::LibSNMP).to receive(:snmp_sess_async_send).with(subject.signature, pointer, instance_of(FFI::Function), nil)
|
27
|
-
expect(subject).to receive(:handle_response).and_return(response)
|
28
|
-
expect(subject.send(pdu)).to be(response)
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
11
|
end
|
data/spec/support/celluloid.rb
CHANGED
@@ -19,4 +19,28 @@ module CelluloidHelpers
|
|
19
19
|
actor.terminate if actor.alive? rescue nil
|
20
20
|
end
|
21
21
|
|
22
|
+
|
23
|
+
class Proxy < NETSNMP::Session::Transport
|
24
|
+
MAXPDUSIZE = 0xffff + 1
|
25
|
+
|
26
|
+
def initialize(host, port)
|
27
|
+
@socket = Celluloid::IO::UDPSocket.new
|
28
|
+
@socket.connect( host, port )
|
29
|
+
@timeout = 2
|
30
|
+
end
|
31
|
+
|
32
|
+
def close
|
33
|
+
@socket.close
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def wait(mode)
|
38
|
+
Celluloid.timeout(@timeout) do
|
39
|
+
@socket.__send__(mode)
|
40
|
+
end
|
41
|
+
rescue Celluloid::TaskTimeout
|
42
|
+
raise Timeout::Error, "Timeout after #{@timeout} seconds"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
22
46
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
RSpec.shared_examples "an snmp client" do
|
2
|
+
let(:device_options) { {
|
3
|
+
host: "localhost",
|
4
|
+
port: SNMPPORT
|
5
|
+
} }
|
6
|
+
let(:protocol_options) { { } }
|
7
|
+
let(:extra_options) { { } }
|
8
|
+
let(:options) { protocol_options.merge(device_options).merge(extra_options) }
|
9
|
+
|
10
|
+
subject { described_class.new(options) }
|
11
|
+
|
12
|
+
describe "#get" do
|
13
|
+
let(:value) { subject.get(oid: get_oid) }
|
14
|
+
it "fetches the varbinds for a given oid" do
|
15
|
+
expect(value).to eq(get_result)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#get_next" do
|
20
|
+
let(:varbind) { subject.get_next(oid: get_oid) }
|
21
|
+
it "fetches the varbinds for the next oid" do
|
22
|
+
oid, value = varbind
|
23
|
+
expect(value).to start_with(next_result)
|
24
|
+
expect(oid).to eq(next_oid)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#walk" do
|
29
|
+
let(:value) { subject.walk(oid: walk_oid) }
|
30
|
+
it "fetches the varbinds for the next oid" do
|
31
|
+
values = value.map {|oid, val| "#{oid}: #{val}" }.join("\n") << "\n"
|
32
|
+
expect(values).to eq(walk_result)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -1,5 +1,19 @@
|
|
1
1
|
sudo docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy -t snmp-server-emulator -f spec/support/Dockerfile .
|
2
|
-
sudo docker run -d -p :1161/udp --name test-snmp-emulator snmp-server-emulator
|
2
|
+
sudo docker run -d -p :1161/udp --name test-snmp-emulator snmp-server-emulator \
|
3
|
+
--v3-engine-id=000000000000000000000002 \
|
4
|
+
--agent-udpv4-endpoint=0.0.0.0:1161 --agent-udpv6-endpoint='[::0]:1161' \
|
5
|
+
--v3-user=simulator --v3-auth-key=auctoritas --v3-priv-key=privatus \
|
6
|
+
--v3-user=authmd5 --v3-auth-key=maplesyrup --v3-auth-proto=MD5 --v3-priv-proto=NONE \
|
7
|
+
--v3-user=authsha --v3-auth-key=maplesyrup --v3-auth-proto=SHA --v3-priv-proto=NONE \
|
8
|
+
--v3-user=authprivshaaes --v3-auth-key=maplesyrup --v3-auth-proto=SHA \
|
9
|
+
--v3-priv-key=maplesyrup --v3-priv-proto=AES \
|
10
|
+
--v3-user=authprivmd5aes --v3-auth-key=maplesyrup --v3-auth-proto=MD5 \
|
11
|
+
--v3-priv-key=maplesyrup --v3-priv-proto=AES \
|
12
|
+
--v3-user=authprivshades --v3-auth-key=maplesyrup --v3-auth-proto=SHA \
|
13
|
+
--v3-priv-key=maplesyrup --v3-priv-proto=DES \
|
14
|
+
--v3-user=authprivmd5des --v3-auth-key=maplesyrup --v3-auth-proto=MD5 \
|
15
|
+
--v3-priv-key=maplesyrup --v3-priv-proto=DES \
|
16
|
+
--v3-user=unsafe --v3-auth-proto=NONE --v3-priv-proto=NONE
|
3
17
|
sleep 20 # give some time for the simulator to boot
|
4
18
|
|
5
19
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
RSpec.describe NETSNMP::V3Session do
|
2
|
+
let(:security_options) { { username: "authprivmd5des", auth_password: "maplesyrup",
|
3
|
+
auth_protocol: :md5, priv_password: "maplesyrup",
|
4
|
+
priv_protocol: :des, security_level: :auth_priv } }
|
5
|
+
it "generates the security parameters handler" do
|
6
|
+
sess = described_class.new(security_options.merge(host: "localhost", port: SNMPPORT))
|
7
|
+
# not generated yet
|
8
|
+
expect(sess.instance_variable_get(:@security_parameters)).to be_a(NETSNMP::SecurityParameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "allows to pass a custom one" do
|
12
|
+
sec_params = NETSNMP::SecurityParameters.new(security_options)
|
13
|
+
sess = described_class.new(host: "localhost", port: SNMPPORT, security_parameters: sec_params)
|
14
|
+
# not generated yet
|
15
|
+
expect(sess.instance_variable_get(:@security_parameters)).to be(sec_params)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "fails if the pass object doesn't follow the expected api" do
|
19
|
+
expect { described_class.new(host: "localhost", port: SNMPPORT, security_parameters: double) }.to raise_error(NETSNMP::Error)
|
20
|
+
end
|
21
|
+
end
|
data/spec/varbind_spec.rb
CHANGED
@@ -1,54 +1,5 @@
|
|
1
1
|
RSpec.describe NETSNMP::Varbind do
|
2
|
-
|
3
|
-
|
4
|
-
subject { NETSNMP::Varbind.new(pointer) }
|
5
|
-
before do
|
6
|
-
allow(NETSNMP::Core::Structures::VariableList).to receive(:new).with(pointer).and_return(struct)
|
7
|
-
end
|
8
|
-
|
9
|
-
it { is_expected.to respond_to(:struct) }
|
10
|
-
|
11
|
-
describe NETSNMP::RequestVarbind do
|
12
|
-
subject { NETSNMP::RequestVarbind.new(pdu, oid, value) }
|
13
|
-
let(:p1) { double(:pdu_pointer) }
|
14
|
-
let(:p2) { double(:oid_pointer) }
|
15
|
-
let(:pdu) { double(:pdu, pointer: p1) }
|
16
|
-
let(:oid) { double(:oid, pointer: p2, length: 2) }
|
17
|
-
context "on initialization" do
|
18
|
-
after { subject }
|
19
|
-
context "when not passed type" do
|
20
|
-
context "and the value is a fixnum" do
|
21
|
-
let(:value) { 1 }
|
22
|
-
it { expect(NETSNMP::Core::LibSNMP).to receive(:snmp_pdu_add_variable).with(p1, p2, 2, instance_of(Fixnum), instance_of(FFI::MemoryPointer), value.size).and_return(pointer) }
|
23
|
-
# TODO: value.length is too abstract. but this value differs between 32 and 64 bit architectures...
|
24
|
-
end
|
25
|
-
context "and the value is a string" do
|
26
|
-
let(:value) { "value" }
|
27
|
-
it { expect(NETSNMP::Core::LibSNMP).to receive(:snmp_pdu_add_variable).with(p1, p2, 2, instance_of(Fixnum), value, 5).and_return(pointer) }
|
28
|
-
end
|
29
|
-
context "and the value is a oid" do
|
30
|
-
let(:value) { NETSNMP::OID.new("SNMPv2-MIB::sysDescr.0") }
|
31
|
-
let(:p3) { double(:value_pointer) }
|
32
|
-
let(:len) { double(:length) }
|
33
|
-
before do
|
34
|
-
expect(value).to receive(:size).and_return(len)
|
35
|
-
expect(value).to receive(:pointer).and_return(p3)
|
36
|
-
end
|
37
|
-
it { expect(NETSNMP::Core::LibSNMP).to receive(:snmp_pdu_add_variable).with(p1, p2, 2, instance_of(Fixnum), p3, len).and_return(pointer) }
|
38
|
-
end
|
39
|
-
context "and the value is nothing" do
|
40
|
-
let(:value) { nil }
|
41
|
-
it { expect(NETSNMP::Core::LibSNMP).to receive(:snmp_pdu_add_variable).with(p1, p2, 2, instance_of(Fixnum), nil, 0).and_return(pointer) }
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
describe NETSNMP::ResponseVarbind do
|
50
|
-
let(:value) { "value" }
|
51
|
-
before { allow(subject).to receive(:load_varbind_value).and_return(value) }
|
52
|
-
|
2
|
+
describe "#to_der" do
|
3
|
+
it { expect(described_class.new(".1.3.6.1.2.1.1.1.0").to_der).to eq("0\f\006\b+\006\001\002\001\001\001\000\005\000".b) }
|
53
4
|
end
|
54
5
|
end
|
metadata
CHANGED
@@ -1,97 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsnmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: ffi
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.9'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.9'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: RubyInline
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.12'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.12'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: rake
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
|
-
- - ~>
|
17
|
+
- - "~>"
|
46
18
|
- !ruby/object:Gem::Version
|
47
19
|
version: 10.4.2
|
48
20
|
type: :development
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
|
-
- - ~>
|
24
|
+
- - "~>"
|
53
25
|
- !ruby/object:Gem::Version
|
54
26
|
version: 10.4.2
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: rspec
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
|
-
- - ~>
|
31
|
+
- - "~>"
|
60
32
|
- !ruby/object:Gem::Version
|
61
33
|
version: 3.3.0
|
62
34
|
type: :development
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
|
-
- - ~>
|
38
|
+
- - "~>"
|
67
39
|
- !ruby/object:Gem::Version
|
68
40
|
version: 3.3.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: em-synchrony
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.4
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.4
|
83
41
|
- !ruby/object:Gem::Dependency
|
84
42
|
name: celluloid-io
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
|
-
- - ~>
|
45
|
+
- - "~>"
|
88
46
|
- !ruby/object:Gem::Version
|
89
47
|
version: 0.17.2
|
90
48
|
type: :development
|
91
49
|
prerelease: false
|
92
50
|
version_requirements: !ruby/object:Gem::Requirement
|
93
51
|
requirements:
|
94
|
-
- - ~>
|
52
|
+
- - "~>"
|
95
53
|
- !ruby/object:Gem::Version
|
96
54
|
version: 0.17.2
|
97
55
|
description: |
|
@@ -102,9 +60,10 @@ executables: []
|
|
102
60
|
extensions: []
|
103
61
|
extra_rdoc_files: []
|
104
62
|
files:
|
105
|
-
- .
|
106
|
-
- .
|
107
|
-
- .
|
63
|
+
- ".coveralls.yml"
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- ".travis.yml"
|
108
67
|
- AUTHORS
|
109
68
|
- Gemfile
|
110
69
|
- LICENSE.txt
|
@@ -112,77 +71,72 @@ files:
|
|
112
71
|
- Rakefile
|
113
72
|
- lib/netsnmp.rb
|
114
73
|
- lib/netsnmp/client.rb
|
115
|
-
- lib/netsnmp/
|
116
|
-
- lib/netsnmp/
|
117
|
-
- lib/netsnmp/
|
118
|
-
- lib/netsnmp/core/inline.rb
|
119
|
-
- lib/netsnmp/core/libc.rb
|
120
|
-
- lib/netsnmp/core/libsnmp.rb
|
121
|
-
- lib/netsnmp/core/structures.rb
|
122
|
-
- lib/netsnmp/core/utilities.rb
|
74
|
+
- lib/netsnmp/encryption/aes.rb
|
75
|
+
- lib/netsnmp/encryption/des.rb
|
76
|
+
- lib/netsnmp/encryption/none.rb
|
123
77
|
- lib/netsnmp/errors.rb
|
124
|
-
- lib/netsnmp/
|
125
|
-
- lib/netsnmp/handlers/em.rb
|
78
|
+
- lib/netsnmp/message.rb
|
126
79
|
- lib/netsnmp/oid.rb
|
127
80
|
- lib/netsnmp/pdu.rb
|
81
|
+
- lib/netsnmp/scoped_pdu.rb
|
82
|
+
- lib/netsnmp/security_parameters.rb
|
128
83
|
- lib/netsnmp/session.rb
|
84
|
+
- lib/netsnmp/v3_session.rb
|
129
85
|
- lib/netsnmp/varbind.rb
|
130
86
|
- lib/netsnmp/version.rb
|
131
87
|
- netsnmp.gemspec
|
132
88
|
- spec/client_spec.rb
|
133
|
-
- spec/core/libc_spec.rb
|
134
|
-
- spec/core/libsnmp_spec.rb
|
135
|
-
- spec/core/structures_spec.rb
|
136
89
|
- spec/handlers/celluloid_spec.rb
|
137
|
-
- spec/handlers/em_client_spec.rb
|
138
90
|
- spec/oid_spec.rb
|
139
91
|
- spec/pdu_spec.rb
|
92
|
+
- spec/security_parameters_spec.rb
|
140
93
|
- spec/session_spec.rb
|
141
94
|
- spec/spec_helper.rb
|
142
95
|
- spec/support/Dockerfile
|
143
96
|
- spec/support/celluloid.rb
|
97
|
+
- spec/support/request_examples.rb
|
144
98
|
- spec/support/start_docker.sh
|
145
99
|
- spec/support/stop_docker.sh
|
100
|
+
- spec/v3_session_spec.rb
|
146
101
|
- spec/varbind_spec.rb
|
147
102
|
homepage: ''
|
148
103
|
licenses:
|
149
104
|
- Apache-2.0
|
150
105
|
metadata:
|
151
|
-
|
106
|
+
allowed_push_host: https://rubygems.org/
|
152
107
|
post_install_message:
|
153
108
|
rdoc_options: []
|
154
109
|
require_paths:
|
155
110
|
- lib
|
156
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
112
|
requirements:
|
158
|
-
- -
|
113
|
+
- - ">="
|
159
114
|
- !ruby/object:Gem::Version
|
160
|
-
version: 2.
|
115
|
+
version: 2.1.0
|
161
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
117
|
requirements:
|
163
|
-
- -
|
118
|
+
- - ">="
|
164
119
|
- !ruby/object:Gem::Version
|
165
120
|
version: '0'
|
166
121
|
requirements:
|
167
122
|
- net-snmp
|
168
123
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.5
|
124
|
+
rubygems_version: 2.2.5
|
170
125
|
signing_key:
|
171
126
|
specification_version: 4
|
172
127
|
summary: SNMP Client library
|
173
128
|
test_files:
|
174
129
|
- spec/client_spec.rb
|
175
|
-
- spec/core/libc_spec.rb
|
176
|
-
- spec/core/libsnmp_spec.rb
|
177
|
-
- spec/core/structures_spec.rb
|
178
130
|
- spec/handlers/celluloid_spec.rb
|
179
|
-
- spec/handlers/em_client_spec.rb
|
180
131
|
- spec/oid_spec.rb
|
181
132
|
- spec/pdu_spec.rb
|
133
|
+
- spec/security_parameters_spec.rb
|
182
134
|
- spec/session_spec.rb
|
183
135
|
- spec/spec_helper.rb
|
184
136
|
- spec/support/Dockerfile
|
185
137
|
- spec/support/celluloid.rb
|
138
|
+
- spec/support/request_examples.rb
|
186
139
|
- spec/support/start_docker.sh
|
187
140
|
- spec/support/stop_docker.sh
|
141
|
+
- spec/v3_session_spec.rb
|
188
142
|
- spec/varbind_spec.rb
|