diff options
author | Wild Kat <wk@users.noreply.github.com> | 2018-05-26 23:49:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-26 23:49:29 +0200 |
commit | 39dbb74c527c054007e26ad34c8921d4be6cb638 (patch) | |
tree | d55745153153450fb40e1f591eb861495a6068d9 /lib/oxidized/model/nxos.rb | |
parent | defdc69f92b3bcf62b1fd3b5ceac63a7a4e637ae (diff) | |
parent | 42bf10b7bce34ff577c469f6c2f659f3913cbf4a (diff) |
Merge branch 'master' into FortiOS-Push
Diffstat (limited to 'lib/oxidized/model/nxos.rb')
-rw-r--r-- | lib/oxidized/model/nxos.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/oxidized/model/nxos.rb b/lib/oxidized/model/nxos.rb index 60d6037..ec1f807 100644 --- a/lib/oxidized/model/nxos.rb +++ b/lib/oxidized/model/nxos.rb @@ -1,8 +1,12 @@ class NXOS < Oxidized::Model - 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 <configuration removed>' cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <configuration removed> ' @@ -10,18 +14,23 @@ class NXOS < Oxidized::Model cfg.gsub! /^(radius-server key).*/, '\\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 + 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 |