Sha256: 93bb85b2b8197c7983df6727544b0d3a072d7a01c46975d3a0acc9dcb31476ba

Contents?: true

Size: 1016 Bytes

Versions: 6

Compression:

Stored size: 1016 Bytes

Contents

class FortiOS < Oxidized::Model

  comment  '# '

  prompt /^([-\w\.]+(\s[\(\w\-\.\)]+)?\~?\s?[#>$]\s?)$/

  expect /^--More--\s$/ do |data, re|
    send ' '
    data.sub re, ''
  end

  cmd :all do |cfg, cmdstring|
    new_cfg = comment "COMMAND: #{cmdstring}\n"
    new_cfg << cfg.each_line.to_a[1..-2].map { |line| line.gsub(/(conf_file_ver=)(.*)/, '\1<stripped>\3') }.join
  end

  cmd 'get system status' do |cfg|
    @vdom_enabled = cfg.include? 'Virtual domain configuration: enable'
    cfg.gsub!(/(System time: )(.*)/, '\1<stripped>\3')
    comment cfg
  end

  post do
    cfg = []
    cfg << cmd('config global') if @vdom_enabled

    cfg << cmd('get hardware status') do |cfg|
      comment cfg
    end

    cfg << cmd('diagnose autoupdate version') do |cfg|
      comment cfg
    end

    cfg << cmd('end') if @vdom_enabled

    cfg << cmd('show')
    cfg.join "\n"
  end

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

  cfg :telnet, :ssh do
    pre_logout "exit\n"
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
oxidized-0.14.3 lib/oxidized/model/fortios.rb
oxidized-0.14.2 lib/oxidized/model/fortios.rb
oxidized-0.14.1 lib/oxidized/model/fortios.rb
oxidized-0.14.0 lib/oxidized/model/fortios.rb
oxidized-0.13.1 lib/oxidized/model/fortios.rb
oxidized-0.13.0 lib/oxidized/model/fortios.rb