Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save elcontrastador/bbe4f04b980d819252a0f2700ab7b803 to your computer and use it in GitHub Desktop.
Save elcontrastador/bbe4f04b980d819252a0f2700ab7b803 to your computer and use it in GitHub Desktop.
Tylers-MacBook-Pro-3:voip tyler$ ruby bin/swcut.rb
From: /Users/tyler/Desktop/hjuhsd_netwk/prj/voip/bin/swcut.rb @ line 19 :
14: # # t.cmd 'exit'
15: # # t.cmd 'exit'
16:
17: session = Net::SSH.start('172.22.142.1','myuser', password: 'mypass')
18: t = Net::SSH::Telnet.new("Session" => session, "Prompt" => /> /)
=> 19: binding.pry
20: puts t.cmd 'show interfaces'
21: t.close
22: session.close
[1] pry(main)> t.cmd "show interfaces ge-0/0/0"
NameError: uninitialized constant Net::ReadTimeout
from /Users/tyler/.rvm/gems/ruby-2.4.0/gems/net-ssh-telnet-0.2.0/lib/net/ssh/telnet.rb:359:in `waitfor'
[2] pry(main)> session.exec!('show interfaces ge-0/0/0')
=> "Physical interface: ge-0/0/0, Enabled, Physical link is Up\n Interface index: 373, SNMP ifIndex: 502\n Link-level type: Ethernet, MTU: 1514, Speed: Auto, Duplex: Auto, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online, Media type: Copper, IEEE 802.3az Energy Efficient Ethernet: Disabled\n Device flags : Present Running\n Interface flags: SNMP-Traps Internal: 0x4000\n Link flags : None\n CoS queues : 8 supported, 8 maximum usable queues\n Current address: f4:cc:55:c1:48:43, Hardware address: f4:cc:55:c1:48:43\n Last flapped : 2017-07-26 14:14:38 GMT+8 (2w3d 03:34 ago)\n Input rate : 0 bps (0 pps)\n Output rate : 1016 bps (1 pps)\n Active alarms : None\n Active defects : None\n Interface transmit statistics: Disabled\n\n Logical interface ge-0/0/0.0 (Index 328) (SNMP ifIndex 503)\n Flags: Up SNMP-Traps 0x4000 Encapsulation: ENET2\n Input packets : 37691\n Output packets: 867846\n Protocol eth-switch\n Flags: None\n"
[3] pry(main)> session.exec!('edit')
=> "Entering configuration mode\nUsers currently editing the configuration:\n oneif terminal p3 (pid 99909) on since 2017-08-12 15:07:06 GMT+8, idle 02:35:14\n {master:0}[edit system services dhcp]\n"
[4] pry(main)> session.exec!('show')
=> "\nerror: syntax error, expecting <command>: show\n"
[5] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment