Closed lollipopman closed 9 years ago
Change
require 'net/netconf'
to
require 'net/netconf/jnpr'
@JamesNickerson Please reopen if issue is still seen.
Hi, I´m having almost the same error.. already checked to be using 'net/netconf/jnpr' Here is the script:
#!/usr/bin/ruby
require 'pp'
require 'net/netconf/jnpr'
require 'junos-ez/stdlib'
require 'highline/import'
# Create a hash map to hold login parameters for NetConf session
login = Hash.new
# Prompt for system IP, username and password
login[:target] = "192.168.108.199"
login[:username] = ask("username: "){ |a| a.echo = true }
# Connect to target and start netconf ssh session
dev = Netconf::SSH.new( login )
dev.open
Junos::Ez::Provider( dev )
pp dev.facts.catalog
dev.close
And here the output:
# ./ruby_ez_1.rb
username: test
/usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:32:in `block (3 levels) in method_missing': undefined method `each' for "show version":String (NoMethodError)
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:391:in `call'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:391:in `insert'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:375:in `method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:31:in `block (2 levels) in method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:391:in `call'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:391:in `insert'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:375:in `method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:31:in `block in method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/builder.rb:293:in `initialize'
from /usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:30:in `new'
from /usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:30:in `method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/net-netconf-0.4.3/lib/net/netconf/rpc.rb:65:in `method_missing'
from /usr/local/rvm/gems/ruby-2.2.1/gems/junos-ez-stdlib-0.1.2/lib/junos-ez/facts/version.rb:22:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.2.1/gems/junos-ez-stdlib-0.1.2/lib/junos-ez/facts.rb:67:in `block in read!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/junos-ez-stdlib-0.1.2/lib/junos-ez/facts.rb:64:in `each'
from /usr/local/rvm/gems/ruby-2.2.1/gems/junos-ez-stdlib-0.1.2/lib/junos-ez/facts.rb:64:in `read!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/junos-ez-stdlib-0.1.2/lib/junos-ez/facts.rb:16:in `Provider'
from ./ruby_ez_1.rb:20:in `<main>'
Any ideas?
When running the above code, we receive this error: