Sha256: 1bc7f991d292f64a9d6f35426ba542112a41d14ff6c22a132e77a852355de44d

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'sloe'
require 'sloe/junos'
# require 'ruby-debug'

describe Sloe do
  context "invoked with block" do
    before(:all) do
      @login = {
        :target => 'capella',
        :username => 'netconf',
        :password => 'netconf'
      }
      @hostname = ''
    end

    it "calls Netconf RPC" do
      Sloe::Device.new( @login ) { |dut| 
        sw_info = dut.rpc.get_system_information
        @hostname = sw_info.xpath('//host-name').text
      }
      @hostname.should include @login[:target]
    end

    it "calls SNMP RPC" do
      Sloe::Device.new ( @login ) { |dut| 
        @hostname = dut.snmp.get_value( 'sysName.0' ).to_s
      }
      @hostname.should include @login[:target]
    end

  end

  context "Junos extensions" do
    before(:all) do
      @login = {
        :target => 'capella',
        :username => 'netconf',
        :password => 'netconf'
      }
    end

    it "Sloe::Junos responds to Junos specific RPCs" do
      Sloe::Junos.new ( @login ) { |dut|
        dut.rpc.respond_to?(:lock_configuration).should be true
      }
    end
    it "Sloe::Device does not respond to Junos specific RPCs" do
      Sloe::Device.new ( @login ) { |dut|
        dut.rpc.respond_to?(:lock_configuration).should be false
      }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sloe-0.7.0 spec/blocks_spec.rb
sloe-0.6.0 spec/blocks_spec.rb
sloe-0.5.4 spec/blocks_spec.rb
sloe-0.5.3 spec/blocks_spec.rb