From 32ea9658e3a51c658e73f8a9279607d6972fd3dd Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 10 Apr 2015 15:16:05 +0200 Subject: ironware model improvement --- lib/oxidized/model/ironware.rb | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'lib/oxidized/model/ironware.rb') 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 -- cgit v1.2.1