forked from ytti/oxidized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h3c.rb
42 lines (33 loc) · 772 Bytes
/
h3c.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
class H3C < Oxidized::Model
using Refinements
# H3C
prompt /^.*([<\[][\w.-]+[>\]])$/
comment '# '
cmd :secret do |cfg|
cfg.gsub! /(pin verify (?:auto|)).*/, '\\1 <PIN hidden>'
cfg.gsub! /(%\^%#.*%\^%#)/, '<secret hidden>'
cfg
end
cmd :all do |cfg|
cfg.cut_both
end
cfg :telnet do
username /^Username:$/
password /^Password:$/
end
cfg :telnet, :ssh do
post_login 'screen-length disable'
pre_logout 'quit'
end
cmd 'display version' do |cfg|
cfg = cfg.each_line.reject { |l| l.match /uptime/ }.join
cfg = cfg.each_line.reject { |l| l.match /Uptime is/ }.join
comment cfg
end
cmd 'display device' do |cfg|
comment cfg
end
cmd 'display current-configuration' do |cfg|
cfg
end
end