sloe 0.3.2 → 0.4.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.
data/README.md CHANGED
@@ -56,6 +56,15 @@ An alternate way to use this module is:
56
56
 
57
57
  All options supported by Netconf, Net::SCP and SNMP are supported in this gem too. The :target option is aliased to the SNMP :host option so there is no need to duplicate that option key.
58
58
 
59
+ ## Vendor specific Netconf extensions
60
+
61
+ Sloe supports vendor specific Netconf extensions. To add that vendor specific support call new() on one of the supported classes. Sloe supports the following:
62
+
63
+ *Sloe::Device - no vendor specific Netconf extensions added
64
+ *Sloe::Junos - Junos vendor specific Netconf extensions added
65
+
66
+ Just simply call Sloe::Junos.new() to get the Junos extensions added
67
+
59
68
  ## SUPPORT
60
69
 
61
70
  This software is not officially supported by Juniper Networks, but by a team dedicated to helping customers, partners, and the development community. To report bug-fixes, issues, susggestions, please contact David Gethings <dgethings@juniper.net>
@@ -1,26 +1,7 @@
1
1
  require 'sloe/version'
2
- require 'net/netconf'
3
- require 'net/scp'
4
- require 'snmp'
5
-
2
+ require 'sloe/device'
3
+ require 'sloe/junos'
6
4
 
7
5
  module Sloe
8
- class Device < Netconf::SSH
9
-
10
- attr_reader :snmp
11
6
 
12
- def initialize(args, &block)
13
- @snmp_args = {:host => args[:target], :mib_dir => args[:mib_dir], :mib_modules => args[:mib_modules]}
14
- @snmp = SNMP::Manager.new(@snmp_args)
15
-
16
- if block_given?
17
- super( args, &block )
18
- return
19
- else
20
- super(args)
21
- self.open
22
- self
23
- end
24
- end
25
- end
26
7
  end
@@ -0,0 +1,23 @@
1
+ require 'net/scp'
2
+ require 'snmp'
3
+
4
+ module Sloe
5
+ class Common < Netconf::SSH
6
+
7
+ attr_reader :snmp
8
+
9
+ def initialize(args, &block)
10
+ @snmp_args = {:host => args[:target], :mib_dir => args[:mib_dir], :mib_modules => args[:mib_modules]}
11
+ @snmp = SNMP::Manager.new(@snmp_args)
12
+
13
+ if block_given?
14
+ super( args, &block )
15
+ return
16
+ else
17
+ super(args)
18
+ self.open
19
+ self
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ require 'net/netconf'
2
+ require 'sloe/common'
3
+
4
+ module Sloe
5
+ class Device < Sloe::Common
6
+
7
+ def initialize(args, &block)
8
+
9
+ # Stop netconf gem from defaulting to :Junos and thus not loading :Junos extensions
10
+ args[:os_type] = :Netconf
11
+ super( args, &block )
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'net/netconf/jnpr'
2
+ require 'sloe/common'
3
+
4
+ module Sloe
5
+ class Junos < Sloe::Common
6
+
7
+ # attr_reader :snmp
8
+
9
+ def initialize(args, &block)
10
+ # @snmp_args = {:host => args[:target], :mib_dir => args[:mib_dir], :mib_modules => args[:mib_modules]}
11
+ # @snmp = SNMP::Manager.new(@snmp_args)
12
+
13
+ # if block_given?
14
+ super( args, &block )
15
+ # return
16
+ # else
17
+ # super(args)
18
+ # self.open
19
+ # self
20
+ # end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Sloe
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'sloe'
2
- require 'ruby-debug'
2
+ require 'sloe/junos'
3
+ # require 'ruby-debug'
3
4
 
4
5
  describe Sloe do
5
6
  context "invoked with block" do
@@ -26,5 +27,28 @@ describe Sloe do
26
27
  }
27
28
  @hostname.should include @login[:target]
28
29
  end
30
+
31
+ end
32
+
33
+ context "Junos extensions" do
34
+ before(:all) do
35
+ @login = {
36
+ :target => 'capella',
37
+ :username => 'dgethings',
38
+ :password => 'mcisamilf'
39
+ }
40
+ end
41
+
42
+ it "Sloe::Junos responds to Junos specific RPCs" do
43
+ Sloe::Junos.new ( @login ) { |dut|
44
+ dut.rpc.respond_to?(:lock_configuration).should be true
45
+ }
46
+ end
47
+ it "Sloe::Device does not respond to Junos specific RPCs" do
48
+ Sloe::Device.new ( @login ) { |dut|
49
+ dut.rpc.respond_to?(:lock_configuration).should be false
50
+ }
51
+ end
52
+
29
53
  end
30
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sloe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-01 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: snmp
@@ -124,6 +124,9 @@ files:
124
124
  - Rakefile
125
125
  - lib/import-mibs.rb
126
126
  - lib/sloe.rb
127
+ - lib/sloe/common.rb
128
+ - lib/sloe/device.rb
129
+ - lib/sloe/junos.rb
127
130
  - lib/sloe/version.rb
128
131
  - mibs/ACCOUNTING-CONTROL-MIB.yaml
129
132
  - mibs/ADSL-LINE-EXT-MIB.yaml