diff options
author | ytti <saku@ytti.fi> | 2016-01-28 02:04:47 +0200 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2016-01-28 02:04:47 +0200 |
commit | 2ac9443b955fb75f4085e6d963904f01c82e700f (patch) | |
tree | dc2db09db54e71a0a5fab020050d83e45c166475 /lib/oxidized | |
parent | 4fbf00dbd1e295664717f0d963e3aadee3935a19 (diff) | |
parent | 135a9123b493ea896b0719395fd1bbfdc628ffe2 (diff) |
Merge pull request #291 from mikebryant/better-aosw
Better aosw collection
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/model/aosw.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index 81d3243..4f09e51 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -11,6 +11,20 @@ class AOSW < Oxidized::Model cfg.each_line.to_a[1..-2].join end + cmd :secret do |cfg| + cfg.gsub!(/PRE-SHARE (\S+)$/, 'PRE-SHARE <secret removed>') + cfg.gsub!(/ipsec (\S+)$/, 'ipsec <secret removed>') + cfg.gsub!(/community (\S+)$/, 'community <secret removed>') + cfg.gsub!(/ sha (\S+)/, ' sha <secret removed>') + cfg.gsub!(/ des (\S+)/, ' des <secret removed>') + cfg.gsub!(/mobility-manager (\S+) user (\S+) (\S+)/, 'mobility-manager \1 user \2 <secret removed>') + cfg.gsub!(/mgmt-user (\S+) (\S+) (\S+)$/, 'mgmt-user \1 \2 <secret removed>') + cfg.gsub!(/key (\S+)$/, 'key <secret removed>') + cfg.gsub!(/secret (\S+)$/, 'secret <secret removed>') + cfg.gsub!(/wpa-passphrase (\S+)$/, 'wpa-passphrase <secret removed>') + cfg + end + cmd 'show version' do |cfg| cfg = cfg.each_line.select { |line| not line.match /Switch uptime/i } comment cfg.join @@ -26,8 +40,15 @@ class AOSW < Oxidized::Model cmd 'show license' do |cfg| comment cfg end - cmd 'show configuration' do |cfg| - cfg + cmd 'show running-config' do |cfg| + out = [] + cfg.each_line do |line| + next if line.match /^controller config \d+$/ + next if line.match /^Building Configuration/ + out << line.strip + end + out = out.join "\n" + out << "\n" end cfg :telnet do @@ -43,6 +64,7 @@ class AOSW < Oxidized::Model end end post_login 'no paging' + post_login 'encrypt disable' if vars :enable pre_logout 'exit' end @@ -56,7 +78,7 @@ class AOSW < Oxidized::Model next if line.match /Output \d Config/i next if line.match /(Tachometers|Temperatures|Voltages)/ next if line.match /((Card|CPU) Temperature|Chassis Fan|VMON1[0-9])/ - next if line.match /[0-9]+ (RPM|RPMs|mV|C)$/ + next if line.match /[0-9]+ (RPMS?|m?V|C)/i out << line.strip end out = comment out.join "\n" |