summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/edgeswitch.rb
blob: 7f5b1ea52b8e0ffe7868bc6879254057aa346c87 (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
class EdgeSwitch < Oxidized::Model

# Ubiquiti EdgeSwitch #

  comment '!'

  prompt /\(.*\)\s[#>]/

  cmd 'show running-config' do |cfg|
    cfg.each_line.to_a[2..-2].reject { |line| line.match /System Up Time.*/ or line.match /Current SNTP Synchronized Time.*/ }.join
  end

  cfg :telnet do
    username /User(name)?:\s?/
    password /^Password:\s?/
  end

  cfg :telnet, :ssh do
    post_login do
      if vars :enable
        send "enable\n"
        cmd vars(:enable)
      else
        cmd 'enable'
      end
      cmd 'terminal length 0'
    end
    pre_logout 'quit'
    pre_logout 'n'
  end

end