Sha256: a4b5ac231a028f2bbccd8bf4ddff5ae464e5cac041ee120f1309b9f5b42e8c1c
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
class NXOS < Oxidized::Model using Refinements prompt /^(\r?[\w.@_()-]+[#]\s?)$/ comment '! ' def filter(cfg) cfg.gsub! /\r\n?/, "\n" cfg.gsub! prompt, '' end cmd :secret do |cfg| cfg.gsub! /^(snmp-server community).*/, '\\1 <secret hidden>' cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <secret hidden> ' cfg.gsub! /^(snmp-server host.*? )\S+( udp-port \d+)?$/, '\\1<secret hidden>\\2' cfg.gsub! /(password \d+) (\S+)/, '\\1 <secret hidden>' cfg.gsub! /^(radius-server key).*/, '\\1 <secret hidden>' cfg.gsub! /^(tacacs-server .*key(?: \d+)?) \S+/, '\\1 <secret hidden>' cfg end cmd 'show version' do |cfg| cfg = filter cfg cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) } comment cfg.join end cmd 'show inventory' do |cfg| cfg = filter cfg comment cfg end cmd 'show running-config' do |cfg| cfg = filter cfg cfg.gsub! /^(show run.*)$/, '! \1' cfg.gsub! /^!Time:[^\n]*\n/, '' cfg.gsub! /^[\w.@_()-]+[#].*$/, '' cfg end cfg :ssh, :telnet do post_login 'terminal length 0' pre_logout 'exit' end cfg :telnet do username /^login:/ password /^Password:/ end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.30.1 | lib/oxidized/model/nxos.rb |
oxidized-0.30.0 | lib/oxidized/model/nxos.rb |