Sha256: 224b8261221d952f8591ce9a45fad2bfffbd9287c0b79abb2fa143b6881e5ef4

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

class ASA < Oxidized::Model

  # Cisco ASA model #
  # Only SSH supported for the sake of security

  prompt /^\r*([\w.@()-\/]+[#>]\s?)$/
  comment  '! '

  cmd :all do |cfg|
    cfg.each_line.to_a[1..-2].join
  end

  cmd :secret do |cfg|
    cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2'
    cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3'
    cfg
  end

  cmd 'show version' do |cfg|
    # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
    cfg = cfg.each_line.select { |line| not line.match /\s+up\s+\d+\s+/ }
    cfg = cfg.join
    comment cfg
  end

  cmd 'more system:running-config' do |cfg|
    cfg = cfg.each_line.to_a[3..-1].join
    cfg.gsub! /^: [^\n]*\n/, ''
    cfg
  end

  cmd 'show inventory' do |cfg|
    comment cfg
  end

  cfg :ssh do
    if vars :enable
      post_login do
        send "enable\n"
        send vars(:enable) + "\n"
      end
    end
    post_login 'terminal pager 0'
    pre_logout 'exit'
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
oxidized-0.8.1 lib/oxidized/model/asa.rb
oxidized-0.8.0 lib/oxidized/model/asa.rb
oxidized-0.7.2 lib/oxidized/model/asa.rb
oxidized-0.7.1 lib/oxidized/model/asa.rb
oxidized-0.7.0 lib/oxidized/model/asa.rb
oxidized-0.6.0 lib/oxidized/model/asa.rb
oxidized-0.5.0 lib/oxidized/model/asa.rb