smi-ffi 0.0.0

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.
@@ -0,0 +1,68 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ Smi::Config.set_path(File.dirname(__FILE__) + '/mibs')
4
+ #Smi::Wrapper.smiSetPath(File.dirname(__FILE__) + '/mibs')
5
+
6
+ Smi::Config.init(nil)
7
+ #Smi::Wrapper.smiInit(nil)
8
+
9
+ ["IF-MIB", "RFC1213-MIB", "IP-MIB"].each do |m|
10
+ Smi::Config.load_module(m)
11
+ #Smi::Wrapper.smiLoadModule(m)
12
+ end
13
+
14
+
15
+ describe "Smi::Config" do
16
+
17
+ it "should get the mib path" do
18
+ Smi::Config.get_path.should match(/mibs/)
19
+ end
20
+ end
21
+
22
+ describe "Smi::Module" do
23
+ it "should get a list of modules" do
24
+ mlist = Smi::Module.get_modules.first.name.should == "IF-MIB"
25
+ end
26
+
27
+ it "should get IF-MIB module" do
28
+ m = Smi::Module.get_module("IF-MIB")
29
+ m.name.should eql("IF-MIB")
30
+ end
31
+
32
+
33
+ it "should get a list of nodes from IF-MIB" do
34
+ m = Smi::Module.get_module("RFC1213-MIB")
35
+ nodes = m.get_nodes
36
+ nodes.count.should eql(11)
37
+ node = nodes.first
38
+ node.name.should eql("mib-2")
39
+ node.oid.should eql("1.3.6.1.2.1")
40
+ end
41
+ end
42
+
43
+ describe "Smi::Node" do
44
+
45
+ it "should get child nodes" do
46
+ node = Smi::Node.get_node("ifEntry")
47
+ node.children.first.name.should eql("ifIndex")
48
+ node.children.last.name.should eql("ifSpecific")
49
+ end
50
+
51
+
52
+ it "should get node from leaf" do
53
+ node = Smi::Node.get_node("ifDescr.5")
54
+ node.name.should eql("ifDescr")
55
+ node.oid.should eql("1.3.6.1.2.1.2.2.1.2")
56
+ end
57
+
58
+ it "should translate oid" do
59
+ Smi.translate("ifDescr.5").should eql("1.3.6.1.2.1.2.2.1.2.5")
60
+ end
61
+
62
+ #it "should do stuff" do
63
+ #node = Smi::Node.get_node("ipAdEntIfIndex")
64
+ #puts node.struct.inspect
65
+ #related = Smi::Wrapper.smiGetRelatedNode(node.struct.pointer)
66
+ #puts related.inspect
67
+ #end
68
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'ffi'
5
+ require 'smi'
6
+
7
+ require 'rspec'
8
+ require 'rspec/autorun'
9
+
10
+ #Spec::Runner.configure do |config|
11
+
12
+ #end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smi-ffi
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - mixtli
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-29 00:00:00 -06:00
18
+ default_executable: smidump.rb
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 0
31
+ - 0
32
+ version: 2.0.0
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: ffi bindings for libsmi
36
+ email: ronmcclain75@gmail.com
37
+ executables:
38
+ - smidump.rb
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
51
+ - bin/smidump.rb
52
+ - c/Makefile
53
+ - c/a.out
54
+ - c/test
55
+ - c/test.c
56
+ - c/test.o
57
+ - interface/smi.h
58
+ - lib/smi.rb
59
+ - lib/smi/config.rb
60
+ - lib/smi/module.rb
61
+ - lib/smi/node.rb
62
+ - lib/smi/wrapper.rb
63
+ - smi-ffi.gemspec
64
+ - spec/mibs/IF-MIB
65
+ - spec/mibs/RFC1213-MIB
66
+ - spec/smi-ffi_spec.rb
67
+ - spec/spec_helper.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/mixtli/smi-ffi
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --charset=UTF-8
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ requirements: []
94
+
95
+ rubyforge_project:
96
+ rubygems_version: 1.3.7
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Ruby Interface to libsmi
100
+ test_files:
101
+ - spec/smi-ffi_spec.rb
102
+ - spec/spec_helper.rb