Class: Netconf::Telnet
Instance Attribute Summary
Attributes inherited from Transport
#capabilities, #rpc, #session_id, #state, #timeout, #waitio
Instance Method Summary
collapse
Methods inherited from Transport
#close, #closed?, #has_capability?, #open, #open?, #rpc_exec, #send_and_receive, #trans_receive_hello, #trans_send_hello
Constructor Details
#initialize(args, trans_args = nil, &block) ⇒ Telnet
Returns a new instance of Telnet.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/net/netconf/telnet.rb', line 7
def initialize( args, trans_args = nil, &block )
os_type = args[:os_type] || Netconf::DEFAULT_OS_TYPE
@args = args.clone
begin
extend Netconf::const_get( os_type )::TransTelnet
rescue NameError
end
my_trans_args = {}
my_trans_args["Host"] = @args[:target]
my_trans_args["Port"] = @args[:port] if @args[:port]
@trans = Net::Telnet.new( my_trans_args )
@trans_timeout = @args[:timeout] || Netconf::DEFAULT_TIMEOUT
@trans_waitio = @args[:waitio] || Netconf::DEFAULT_WAITIO
super( &block )
end
|
Instance Method Details
#trans_open(&block) ⇒ Object
31
32
33
34
35
|
# File 'lib/net/netconf/telnet.rb', line 31
def trans_open( &block )
trans_login()
trans_start_netconf()
self
end
|
#trans_send(cmd_str) ⇒ Object
42
43
44
|
# File 'lib/net/netconf/telnet.rb', line 42
def trans_send( cmd_str )
@trans.write( cmd_str )
end
|