Skip to content

Instantly share code, notes, and snippets.

@XANi
Last active July 22, 2020 19:10
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save XANi/502044d20852abf7c2c351a65f5a5fb2 to your computer and use it in GitHub Desktop.
class Nortel < Oxidized::Model
# nortel switch config download
prompt /^>>.+\#\s/
comment '/* '
cmd '/info/sys/general' do |c|
comment c
end
cmd '/info/link' do |c|
comment c
end
cmd '/info/port' do |c|
comment c
end
cmd '/cfg/dump'
cmd '/info/sys/chassis' do |c|
comment c
end
cmd '/boot/cur' do |c|
comment c
end
# cleanup function, pager can't be turned off ;/
cmd :all do |data|
out = ""
data.split("\n").each do |data|
if data !~ /.*\x27.*/ && data !~ /^.*\x08\x20\x08.*/
out = out + data + "\n"
data = ""
else
data.gsub!(/.*\x08/,'')
data.gsub!(/.*\x27/,'')
out = out + data + "\n"
end
end
out
end
expect /.*any other key.*/ do |data, re|
send ' '
data.sub re, ''
end
# cfg :ssh do
# username /^login as:\s$/
# password /^.+password:\s$/
# pre_logout 'exit'
# end
cfg :telnet do
username /login username:/
password /login password:/
pre_logout 'exit'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment