Skip to content

Instantly share code, notes, and snippets.

@routelastresort
Created August 6, 2013 07:31
Show Gist options
  • Save routelastresort/6162798 to your computer and use it in GitHub Desktop.
Save routelastresort/6162798 to your computer and use it in GitHub Desktop.
Test Netconf over Serial against a VSRX VM - the serial_port should change to whatever 'socat -d -d unix-connect:/tmp/socketname pty' tells you
require 'net/netconf/jnpr/serial'
puts "NETCONF v.#{Netconf::VERSION}"
serial_port = '/dev/pts/1'
login = { port: serial_port,
username: "netdevops",
password: "netdevops1" }
puts "Connecting to SERIAL: #{serial_port} ... please wait."
Netconf::Serial.new( login ){ |dev|
puts "Connected."
puts "Nabbing Inventory ..."
inv = dev.rpc.get_chassis_inventory
puts "Chassis: " + inv.xpath('chassis/description').text
puts "Chassis Serial-Number: " + inv.xpath('chassis/serial-number').text
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment