blob: a6072b6894c40117d339c552882a7fa578ef836d (
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
46
47
48
49
50
51
52
53
54
55
|
class Hatteras < Oxidized::Model
# Hatteras Networks
prompt /^(\r?[\w.@()-]+[#>]\s?)$/
comment '# '
expect /WARNING: System configuration changes will be lost when the device restarts./ do |data, re|
send "y\r"
data.sub re, ''
end
cmd :secret do |cfg|
cfg.gsub! /^(community) \S+/, '\\1 "<configuration removed>"'
cfg.gsub! /^(communityString) "\S+"/, '\\1 "<configuration removed>"'
cfg.gsub! /^(key) "\S+"/, '\\1 "<secret hidden>"'
cfg
end
cmd :all do |cfg|
cfg.cut_both
end
cmd "show switch\r" do |cfg|
cfg = cfg.each_line.reject { |line|
line.match /Switch uptime|Switch temperature|Last reset reason/ or
line.match /TermCpuUtil|^\s+\^$|ERROR: Bad command/
} .join
comment cfg
end
cmd "show card\r" do |cfg|
cfg = cfg.each_line.reject { |line|
line.match /Card uptime|Card temperature|Last reset reason/ or
line.match /TermCpuUtil|^\s+\^$|ERROR: Bad command/
} .join
comment cfg
end
cmd "show sfp *\r" do |cfg|
comment cfg
end
cmd "show config run\r" do |cfg|
cfg
end
cfg :telnet do
username /^Login:/
password /^Password:/
end
cfg :telnet, :ssh do
pre_logout "logout\r"
end
end
|