sloe 0.5.1 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -61,6 +61,7 @@ All options supported by Netconf, Net::SCP and SNMP are supported in this gem to
61
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
62
 
63
63
  *Sloe::Device - no vendor specific Netconf extensions added
64
+
64
65
  *Sloe::Junos - Junos vendor specific Netconf extensions added
65
66
 
66
67
  Just simply call `Sloe::Junos.new()` to get the Junos extensions added
@@ -74,10 +75,7 @@ As well as supporting Junos specific Netconf RPCs Sloe::Junos also supports the
74
75
  device.cli("show version")
75
76
  device.cli("show ospf interfaces")
76
77
 
77
- By default this call will respond with an XML result tree fragment, a Nokogiri::XML object. To get what you would see on the CLI modify the `cli()` call with the `:format => 'text'` attribute and chain the Nokogiri `text()` method. Here is an example that will return just the output from "show version"
78
-
79
- device.cli("show version", :format => 'text').text
80
-
78
+ By default this call will respond with a string. This should make this call compatable with existing automation scripts that are based on CLI commands. To get an XML result tree fragment use the rpc.command() API.
81
79
 
82
80
  ## SUPPORT
83
81
 
data/lib/sloe/device.rb CHANGED
@@ -6,7 +6,8 @@ module Sloe
6
6
 
7
7
  def initialize(args, &block)
8
8
 
9
- # Stop netconf gem from defaulting to :Junos and thus not loading :Junos extensions
9
+ # Stop netconf gem from defaulting to :Junos and thus
10
+ # not loading :Junos extensions
10
11
  args[:os_type] = :Netconf
11
12
  super( args, &block )
12
13
  end
data/lib/sloe/junos.rb CHANGED
@@ -8,8 +8,9 @@ module Sloe
8
8
  super( args, &block )
9
9
  end
10
10
 
11
- def cli(cmd_str, attrs = nil)
12
- self.rpc.command(cmd_str, attrs)
11
+ def cli(cmd_str, attrs = { :format => 'text' })
12
+ attrs[:format] ||= 'text'
13
+ self.rpc.command(cmd_str, attrs).text
13
14
  end
14
15
  end
15
16
  end
data/lib/sloe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sloe
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.3"
3
3
  end
data/spec/blocks_spec.rb CHANGED
@@ -7,8 +7,8 @@ describe Sloe do
7
7
  before(:all) do
8
8
  @login = {
9
9
  :target => 'capella',
10
- :username => 'dgethings',
11
- :password => 'mcisamilf'
10
+ :username => 'netconf',
11
+ :password => 'netconf'
12
12
  }
13
13
  @hostname = ''
14
14
  end
@@ -34,8 +34,8 @@ describe Sloe do
34
34
  before(:all) do
35
35
  @login = {
36
36
  :target => 'capella',
37
- :username => 'dgethings',
38
- :password => 'mcisamilf'
37
+ :username => 'netconf',
38
+ :password => 'netconf'
39
39
  }
40
40
  end
41
41
 
data/spec/methods_spec.rb CHANGED
@@ -7,8 +7,8 @@ describe Sloe do
7
7
  @jnx_mibs = Dir.glob("./mibs/JUNIPER-*.yaml").map { |f| File.basename(f, '.yaml') }
8
8
  @args = {
9
9
  :target => 'capella',
10
- :username => 'dgethings',
11
- :password => 'mcisamilf',
10
+ :username => 'netconf',
11
+ :password => 'netconf',
12
12
  :mib_dir => './mibs',
13
13
  :mib_modules => ["SNMPv2-SMI", "SNMPv2-MIB", "IF-MIB", "IP-MIB", "TCP-MIB", "UDP-MIB"].concat(@jnx_mibs)
14
14
  }
@@ -44,7 +44,7 @@ describe Sloe do
44
44
  end
45
45
 
46
46
  context "NETCONF API" do
47
- it "rpc.get_interface_information() functioons without error" do
47
+ it "rpc.get_interface_information() functions without error" do
48
48
  lambda { @dut.rpc.get_interface_information() }.should_not raise_error
49
49
  end
50
50
  it "rpc.get_ospf_neighbor_information() functions without error" do
@@ -66,11 +66,16 @@ describe Sloe do
66
66
  end
67
67
 
68
68
  context "CLI API" do
69
- it "cli.('show version') functions without error" do
69
+ it "cli('show version') functions without error" do
70
70
  lambda { @dut.cli("show version") }.should_not raise_error
71
71
  end
72
- it "cli.('show version') contains OS information" do
73
- @dut.cli("show version").text.should =~ /JUNOS Base OS/
72
+ it "cli('show version') contains OS information" do
73
+ @dut.cli("show version").should be_a(String)
74
+ @dut.cli("show version").should =~ /JUNOS Base OS/
75
+ end
76
+ it "cli('show version', :foo => 'bar') still contains OS information" do
77
+ @dut.cli("show version", :foo => 'bar').should be_a(String)
78
+ @dut.cli("show version", :foo => 'bar').should =~ /JUNOS Base OS/
74
79
  end
75
80
  end
76
81
  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.5.1
4
+ version: 0.5.3
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-05 00:00:00.000000000 Z
12
+ date: 2013-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: snmp