summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/fujitsupy.rb
blob: a0614f945c0e5139e9589ef01578a01461a5c07a (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
class FujitsuPY < Oxidized::Model
  prompt /^(\([\w.-]*\)\s#|^\S+#\s)$/
  comment  '! '

  cmd :all do |cfg|
    cfg.cut_both
  end

  # 1Gbe switch
  cmd 'show version' do |cfg|
    cfg.gsub! /^(<ERROR> : 2 : format error)$/, ''
    comment cfg
  end

  # 10Gbe switch
  cmd 'show system information' do |cfg|
    cfg.gsub! /^Current-time : [\w\s:]*$/, ''
    cfg.gsub! /^(\s{33}\^)$/, ''
    cfg.gsub! /^(% Invalid input detected at '\^' marker.)$/, ''
    comment cfg
  end

  cmd 'show running-config' do |cfg|
    cfg
  end

  cfg :telnet do
    username /^Username:/
    password /^Password:/
  end

  cfg :telnet, :ssh do
    post_login 'no pager'
    post_login 'terminal pager disable'
    pre_logout do
      send "quit\n"
      send "n\n"
    end
  end
end