diff options
| author | ytti <saku@ytti.fi> | 2015-04-10 16:40:36 +0300 | 
|---|---|---|
| committer | ytti <saku@ytti.fi> | 2015-04-10 16:40:36 +0300 | 
| commit | 130c46b33f6a2e5c774587874fc67f91192c6bf1 (patch) | |
| tree | 6842a5665b8c07eb7381fa432aefeda60fcf2b95 /lib/oxidized/model | |
| parent | 401e857c11332bfcc34f4304c85e7ddde4b8cd31 (diff) | |
| parent | 32ea9658e3a51c658e73f8a9279607d6972fd3dd (diff) | |
Merge pull request #101 from FlorianDoublet/ironwareModif
ironware model improvement
Diffstat (limited to 'lib/oxidized/model')
| -rw-r--r-- | lib/oxidized/model/ironware.rb | 34 | 
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 | 
