diff options
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r-- | lib/oxidized/model/aosw.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/asa.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/asyncos.rb | 88 | ||||
-rw-r--r-- | lib/oxidized/model/ciscosma.rb | 80 | ||||
-rw-r--r-- | lib/oxidized/model/comware.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/cumulus.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/firewareos.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/powerconnect.rb | 4 | ||||
-rw-r--r-- | lib/oxidized/model/procurve.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/routeros.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/vrp.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/zhoneolt.rb | 2 |
12 files changed, 95 insertions, 95 deletions
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index 71fde2e..3397305 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -40,7 +40,7 @@ class AOSW < Oxidized::Model end cmd 'show version' do |cfg| - cfg = cfg.each_line.select { |line| not line.match /(Switch|AP) uptime/i } + cfg = cfg.each_line.reject { |line| line.match /(Switch|AP) uptime/i } rstrip_cfg comment cfg.join end diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index 9df4206..bea0705 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -27,7 +27,7 @@ class ASA < Oxidized::Model cmd 'show version' do |cfg| # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours - cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ } + cfg = cfg.each_line.reject { |line| line.match /(\s+up\s+\d+\s+)|(.*days.*)/ } cfg = cfg.join comment cfg end diff --git a/lib/oxidized/model/asyncos.rb b/lib/oxidized/model/asyncos.rb index 875690b..ac19e34 100644 --- a/lib/oxidized/model/asyncos.rb +++ b/lib/oxidized/model/asyncos.rb @@ -1,49 +1,49 @@ class AsyncOS < Oxidized::Model - # ESA prompt "(mail.example.com)> " - prompt /^\r*([(][\w. ]+[)][#>]\s+)$/ - comment '! ' - - # Select passphrase display option - expect /\[\S+\]>\s/ do |data, re| - send "3\n" - data.sub re, '' - end - - # handle paging - expect /-Press Any Key For More-+.*$/ do |data, re| - send " " - data.sub re, '' - end - - cmd 'version' do |cfg| - comment cfg - end + # ESA prompt "(mail.example.com)> " + prompt /^\r*([(][\w. ]+[)][#>]\s+)$/ + comment '! ' + + # Select passphrase display option + expect /\[\S+\]>\s/ do |data, re| + send "3\n" + data.sub re, '' + end + + # handle paging + expect /-Press Any Key For More-+.*$/ do |data, re| + send " " + data.sub re, '' + end + + cmd 'version' do |cfg| + comment cfg + end - cmd 'showconfig' do |cfg| - #Delete hour and date which change each run - #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:' - # Delete select passphrase display option - cfg.gsub! /Choose the passphrase option:/, '' - cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, '' - cfg.gsub! /loadconfig command\)/, '' - cfg.gsub! /2. Encrypt passphrases/, '' - cfg.gsub! /3. Plain passphrases/, '' - cfg.gsub! /^3$/, '' - #Delete space - cfg.gsub! /\n\s{25,26}/, '' - #Delete after line - cfg.gsub! /([-\\\/,.\w><@]+)(\s{25,27})/,"\\1" - # Add a carriage return - cfg.gsub! /([-\\\/,.\w><@]+)(\s{6})([-\\\/,.\w><@]+)/,"\\1\n\\2\\3" - # Delete prompt - cfg.gsub! /^\r*([(][\w. ]+[)][#>]\s+)$/, '' - cfg + cmd 'showconfig' do |cfg| + #Delete hour and date which change each run + #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:' + # Delete select passphrase display option + cfg.gsub! /Choose the passphrase option:/, '' + cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, '' + cfg.gsub! /loadconfig command\)/, '' + cfg.gsub! /2. Encrypt passphrases/, '' + cfg.gsub! /3. Plain passphrases/, '' + cfg.gsub! /^3$/, '' + #Delete space + cfg.gsub! /\n\s{25,26}/, '' + #Delete after line + cfg.gsub! /([-\\\/,.\w><@]+)(\s{25,27})/,"\\1" + # Add a carriage return + cfg.gsub! /([-\\\/,.\w><@]+)(\s{6})([-\\\/,.\w><@]+)/,"\\1\n\\2\\3" + # Delete prompt + cfg.gsub! /^\r*([(][\w. ]+[)][#>]\s+)$/, '' + cfg - end - - cfg :ssh do - pre_logout "exit" - end - + end + + cfg :ssh do + pre_logout "exit" + end + end diff --git a/lib/oxidized/model/ciscosma.rb b/lib/oxidized/model/ciscosma.rb index a52e38a..6777ad5 100644 --- a/lib/oxidized/model/ciscosma.rb +++ b/lib/oxidized/model/ciscosma.rb @@ -1,45 +1,45 @@ class CiscoSMA < Oxidized::Model - # SMA prompt "mail.example.com> " - prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/ - comment '! ' - - # Select passphrase display option - expect /using loadconfig command\. \[Y\]\>/ do |data, re| - send "y\n" - data.sub re, '' - end - - # handle paging - expect /-Press Any Key For More-+.*$/ do |data, re| - send " " - data.sub re, '' - end - - cmd 'version' do |cfg| - comment cfg - end + # SMA prompt "mail.example.com> " + prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/ + comment '! ' + + # Select passphrase display option + expect /using loadconfig command\. \[Y\]\>/ do |data, re| + send "y\n" + data.sub re, '' + end + + # handle paging + expect /-Press Any Key For More-+.*$/ do |data, re| + send " " + data.sub re, '' + end + + cmd 'version' do |cfg| + comment cfg + end - cmd 'showconfig' do |cfg| - #Delete hour and date which change each run - #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:' - # Delete select passphrase display option - cfg.gsub! /Do you want to mask the password\? Files with masked passwords cannot be loaded/, '' - cfg.gsub! /^\s+y/, '' - # Delete space - cfg.gsub! /\n\s{25}/, '' - # Delete after line - cfg.gsub! /([\/\-,.\w><@]+)(\s{27})/,"\\1" - # Add a carriage return - cfg.gsub! /([\/\-,.\w><@]+)(\s{6,8})([\/\-,.\w><@]+)/,"\\1\n\\2\\3" - # Delete prompt - cfg.gsub! /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/, '' - cfg + cmd 'showconfig' do |cfg| + #Delete hour and date which change each run + #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:' + # Delete select passphrase display option + cfg.gsub! /Do you want to mask the password\? Files with masked passwords cannot be loaded/, '' + cfg.gsub! /^\s+y/, '' + # Delete space + cfg.gsub! /\n\s{25}/, '' + # Delete after line + cfg.gsub! /([\/\-,.\w><@]+)(\s{27})/,"\\1" + # Add a carriage return + cfg.gsub! /([\/\-,.\w><@]+)(\s{6,8})([\/\-,.\w><@]+)/,"\\1\n\\2\\3" + # Delete prompt + cfg.gsub! /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/, '' + cfg - end - - cfg :ssh do - pre_logout "exit" - end - + end + + cfg :ssh do + pre_logout "exit" + end + end diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index a5b7190..0ba26d5 100644 --- a/lib/oxidized/model/comware.rb +++ b/lib/oxidized/model/comware.rb @@ -47,7 +47,7 @@ class Comware < Oxidized::Model end cmd 'display version' do |cfg| - cfg = cfg.each_line.select {|l| not l.match /uptime/i }.join + cfg = cfg.each_line.reject { |l| l.match /uptime/i }.join comment cfg end diff --git a/lib/oxidized/model/cumulus.rb b/lib/oxidized/model/cumulus.rb index 20acb8a..09f3955 100644 --- a/lib/oxidized/model/cumulus.rb +++ b/lib/oxidized/model/cumulus.rb @@ -68,7 +68,7 @@ class Cumulus < Oxidized::Model cfg += add_comment 'TRAFFIC' cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf' - + cfg += add_comment 'ACL' cfg += cmd 'iptables -L -n' diff --git a/lib/oxidized/model/firewareos.rb b/lib/oxidized/model/firewareos.rb index 1b3d07c..31770dc 100644 --- a/lib/oxidized/model/firewareos.rb +++ b/lib/oxidized/model/firewareos.rb @@ -15,7 +15,7 @@ class FirewareOS < Oxidized::Model cmd 'show sysinfo' do |cfg| # avoid commits due to uptime - cfg = cfg.each_line.select { |line| not line.match /(.*time.*)|(.*memory.*)|(.*cpu.*)/ } + cfg = cfg.each_line.reject { |line| line.match /(.*time.*)|(.*memory.*)|(.*cpu.*)/ } cfg = cfg.join comment cfg end diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index f602a36..ca91e60 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -22,7 +22,7 @@ class PowerConnect < Oxidized::Model if (@stackable.nil?) @stackable = true if cfg.match /(U|u)nit\s/ end - cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] } + cfg = cfg.split("\n").reject { |line| line[/Up\sTime/] } comment cfg.join("\n") + "\n" end @@ -72,7 +72,7 @@ class PowerConnect < Oxidized::Model end out << line.strip end - out = out.select { |line| not line[/Up\sTime/] } + out = out.reject { |line| line[/Up\sTime/] } out = comment out.join "\n" out << "\n" end diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 444fb5b..705a814 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -67,7 +67,7 @@ class Procurve < Oxidized::Model # not supported on all models cmd 'show system information' do |cfg| - cfg = cfg.each_line.select { |line| not line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ } + cfg = cfg.each_line.reject { |line| line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ } cfg = cfg.join comment cfg end diff --git a/lib/oxidized/model/routeros.rb b/lib/oxidized/model/routeros.rb index 6717446..b62a3be 100644 --- a/lib/oxidized/model/routeros.rb +++ b/lib/oxidized/model/routeros.rb @@ -20,7 +20,7 @@ class RouterOS < Oxidized::Model cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours cfg.gsub! /\\\r\n\s+/, '' # strip new line cfg.gsub! /# inactive time\r\n/, '' # Remove time based system comment - cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] } + cfg = cfg.split("\n").reject { |line| line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] } cfg.join("\n") + "\n" end end diff --git a/lib/oxidized/model/vrp.rb b/lib/oxidized/model/vrp.rb index 98229c3..e44f69e 100644 --- a/lib/oxidized/model/vrp.rb +++ b/lib/oxidized/model/vrp.rb @@ -25,7 +25,7 @@ class VRP < Oxidized::Model end cmd 'display version' do |cfg| - cfg = cfg.each_line.select {|l| not l.match /uptime/ }.join + cfg = cfg.each_line.reject { |l| l.match /uptime/ }.join comment cfg end diff --git a/lib/oxidized/model/zhoneolt.rb b/lib/oxidized/model/zhoneolt.rb index b60edb2..c50680c 100644 --- a/lib/oxidized/model/zhoneolt.rb +++ b/lib/oxidized/model/zhoneolt.rb @@ -39,7 +39,7 @@ class ZhoneOLT < Oxidized::Model end cmd 'dump console' do |cfg| - cfg = cfg.each_line.select { |line| not line.match /To Abort the operation enter Ctrl-C/ }.join + cfg = cfg.each_line.reject { |line| line.match /To Abort the operation enter Ctrl-C/ }.join end # zhone technically supports ssh, but it locks up a ton. Especially when |