Sha256: 2e1a499f8006d1c73ba8afc771551bcc8839dea0efd03c42bddcc8fb61559f17

Contents?: true

Size: 955 Bytes

Versions: 4

Compression:

Stored size: 955 Bytes

Contents

class ComnetMS < Oxidized::Model
  using Refinements

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

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

  cmd 'show running-config' do |cfg|
    cfg.gsub! "\n\r", "\n"
    cfg.gsub! /^[\r\n\s]*Building configuration\.\.\.\n/, ''
    cfg.gsub! /^end\n/, ''
    cfg
  end

  cmd 'show version' do |cfg|
    cfg.gsub! "\n\r", "\n"
    cfg.gsub! /^MEMORY\s*:.*\n/, ''
    cfg.gsub! /^FLASH\s*:.*\n/, ''
    cfg.gsub! /^Previous Restart\s*:.*\n/, ''
    cfg.gsub! /^System Time\s*:.*\n/, ''
    cfg.gsub! /^System Uptime\s*:.*\n/, ''
    comment cfg
  end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oxidized-0.31.0 lib/oxidized/model/comnetms.rb
oxidized-0.30.1 lib/oxidized/model/comnetms.rb
oxidized-0.30.0 lib/oxidized/model/comnetms.rb
oxidized-0.29.1 lib/oxidized/model/comnetms.rb