Class: Puppet::Util::NetworkDevice::Transport::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/network_device/transport/base.rb

Direct Known Subclasses

Ssh, Telnet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



9
10
11
# File 'lib/puppet/util/network_device/transport/base.rb', line 9

def initialize
  @timeout = 10
end

Instance Attribute Details

#default_promptObject

Returns the value of attribute default_prompt.



7
8
9
# File 'lib/puppet/util/network_device/transport/base.rb', line 7

def default_prompt
  @default_prompt
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/puppet/util/network_device/transport/base.rb', line 6

def host
  @host
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/puppet/util/network_device/transport/base.rb', line 6

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/puppet/util/network_device/transport/base.rb', line 6

def port
  @port
end

#timeoutObject

Returns the value of attribute timeout.



7
8
9
# File 'lib/puppet/util/network_device/transport/base.rb', line 7

def timeout
  @timeout
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/puppet/util/network_device/transport/base.rb', line 6

def user
  @user
end

Instance Method Details

#command(cmd, options = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/puppet/util/network_device/transport/base.rb', line 19

def command(cmd, options = {})
  send(cmd)
  expect(options[:prompt] || default_prompt) do |output|
    yield output if block_given?
  end
end

#expect(prompt) ⇒ Object



16
17
# File 'lib/puppet/util/network_device/transport/base.rb', line 16

def expect(prompt)
end

#send(cmd) ⇒ Object



13
14
# File 'lib/puppet/util/network_device/transport/base.rb', line 13

def send(cmd)
end