Sha256: c5f26f0e3061a15dbc44a9f46a41fcdd3fd21946deb76eb9ded35bd09977b5c6

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

class RGOS < Oxidized::Model
  using Refinements

  comment '! '

  cmd :secret do |cfg|
    cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
    cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
    cfg.gsub! /^(enable (password|secret)( level \d+)?( \d)?) .+/, '\\1 <secret hidden>'
    cfg
  end

  cmd 'show version' do |cfg|
    cfg = cfg.each_line.reject { |line| line.match /^System start time/ }.join
    cfg = cfg.each_line.reject { |line| line.match /^System uptime/ }.join
    comment "#{cfg.cut_both}\n"
  end

  cmd 'show running-config' do |cfg|
    cfg = cfg.each_line.reject { |line| line.match /^Building configuration.../ }.join
    cfg = cfg.each_line.reject { |line| line.match /^Current configuration : \d+ bytes/ }.join
    cfg = cfg.each_line.reject { |line| line.match /^version [\d\w()]+/ }.join
    # remove empty lines
    cfg = cfg.each_line.reject { |line| line.match /^[\r\n\s\u0000#]+$/ }.join
    cfg.cut_both
  end

  cfg :telnet, :ssh do
    post_login 'terminal length 0'
    post_login 'terminal width 0'
    pre_logout 'exit'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oxidized-0.30.1 lib/oxidized/model/rgos.rb
oxidized-0.30.0 lib/oxidized/model/rgos.rb