forked from ytti/oxidized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenterasys.rb
43 lines (33 loc) · 838 Bytes
/
enterasys.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Enterasys < Oxidized::Model
# Enterasys B3/C3 models #
prompt /^.+\w\((su|rw)\)->\s?$/
comment '!'
# Handle paging
expect /^--More--.*$/ do |data, re|
send ' '
data.sub re, ''
end
cmd :all do |cfg|
cfg.each_line.to_a[2..-3].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
end
cmd 'show system hardware' do |cfg|
comment cfg
end
cmd 'show version' do |cfg|
comment cfg
end
cmd 'show config' do |cfg|
cfg.gsub! /^This command shows non-default configurations only./, ''
cfg.gsub! /^Use 'show config all' to show both default and non-default configurations./, ''
cfg.gsub! /^!|#.*/, ''
cfg.gsub! /^$\n/, ''
cfg
end
cfg :telnet do
username /^Username:/i
password /^Password:/i
end
cfg :telnet, :ssh do
pre_logout 'exit'
end
end