Created
August 6, 2013 07:31
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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