blob: 8675263034d753e0269e97847b1477760da89b2f (
plain)
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
44
45
|
class AricentISS < Oxidized::Model
prompt (/^(\e\[27m)?[ \r]*\w+# ?$/)
cfg :ssh do
post_login 'no cli pagignation'
pre_logout 'exit'
end
cmd :all do |cfg|
# * Drop first line that contains the command, and the last line that
# contains a prompt
# * Strip carriage returns
cfg.delete("\r").each_line.to_a[1..-2].join
end
cmd :secret do |cfg|
cfg.gsub(/^(snmp community) .*/, '\1 <hidden>')
end
cmd 'show system information' do |cfg|
cfg.sub! /^Device Up Time.*\n/, ''
cfg.delete! "\r"
comment(cfg).gsub(/ +$/, '')
end
cmd 'show running-config' do |cfg|
comment_next = 0
cfg.each_line.map { |l|
next '' if l.match /^Building configuration/
if l.match /^Switch ID.*Hardware Version.*Firmware Version/ then
comment_next = 2
end
if comment_next > 0 then
comment_next -= 1
next comment(l)
end
l
}.join.gsub(/ +$/, '')
end
end
|