Class: Sloe::Common

Inherits:
Netconf::SSH
  • Object
show all
Defined in:
lib/sloe/common.rb

Overview

Base class. Inherits from Netconf::SSH

Direct Known Subclasses

Device, Junos

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, &block) ⇒ Common

Create Sloe::Common object. Accepts arguments for Netconf::SSH#new and SNMP::Manager#new



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sloe/common.rb', line 14

def initialize(args, &block)
  @snmp_args = {
    :host        => args[:target], 
    :mib_dir     => args[:mib_dir], 
    :mib_modules => args[:mib_modules],
    :community   => args[:community]
  }
  @snmp = SNMP::Manager.new(@snmp_args)

  # logging of RPCs is optional. If arguments are provided then
  # they must be needed/enabled. This also requires extending
  # Netconf::RPC::Executor.method_missing(), which is done below
  self.logging = args[:logging]
  
  if block_given?
    super( args, &block )
    return
  else
    super(args)
    self.open
    self
  end
end

Instance Attribute Details

#loggingObject

Returns the value of attribute logging.



10
11
12
# File 'lib/sloe/common.rb', line 10

def logging
  @logging
end

#snmpObject (readonly)

Provides access to the SNMP object



9
10
11
# File 'lib/sloe/common.rb', line 9

def snmp
  @snmp
end