summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@debian-Florian>2015-04-10 15:16:05 +0200
committerflorian <florian@debian-Florian>2015-04-10 15:16:05 +0200
commit32ea9658e3a51c658e73f8a9279607d6972fd3dd (patch)
tree6842a5665b8c07eb7381fa432aefeda60fcf2b95
parent401e857c11332bfcc34f4304c85e7ddde4b8cd31 (diff)
ironware model improvement
-rw-r--r--lib/oxidized/model/ironware.rb34
1 files changed, 32 insertions, 2 deletions
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb
index f9998ae..2f8df7f 100644
--- a/lib/oxidized/model/ironware.rb
+++ b/lib/oxidized/model/ironware.rb
@@ -1,9 +1,22 @@
class IronWare < Oxidized::Model
+ prompt /^((\w*)@(.*)([>#])+)$/
comment '! '
+
+ #to handle pager without enable
+ #expect /^((.*)--More--(.*))$/ do |data, re|
+ # send ' '
+ # data.sub re, ''
+ #end
+
+
+ #to remove backspace (if handle pager without enable)
+ #expect /^((.*)[\b](.*))$/ do |data, re|
+ # data.sub re, ''
+ #end
cmd :all do |cfg|
- cfg.each_line.to_a[1..-3].join
+ cfg.each_line.to_a[1..-2].join
end
cmd 'show running-config' do |cfg|
@@ -12,11 +25,21 @@ class IronWare < Oxidized::Model
end
cmd 'show version' do |cfg|
+ cfg.gsub! /(^((.*)system uptime(.*))$)/, '' #remove unwanted line system uptime
comment cfg
end
cmd 'show chassis' do |cfg|
cfg.gsub! "\xFF", '' # ugly hack - avoids JSON.dump utf-8 breakage on 1.9..
+ cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature
+ comment cfg
+ end
+
+ cmd 'show flash' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show module' do |cfg|
comment cfg
end
@@ -25,9 +48,16 @@ class IronWare < Oxidized::Model
password /^Password:/
end
+ #handle pager with enable
cfg :telnet, :ssh do
+ if vars :enable
+ post_login do
+ send "enable\n"
+ send vars(:enable) + "\n"
+ end
+ end
post_login 'skip-page-display'
pre_logout 'logout'
end
-end
+end \ No newline at end of file