diff options
| author | ytti <saku@ytti.fi> | 2014-07-22 20:20:08 +0300 | 
|---|---|---|
| committer | ytti <saku@ytti.fi> | 2014-07-22 20:20:08 +0300 | 
| commit | 28b8702d3419932e248382c07784c5fc3c823309 (patch) | |
| tree | 95ca29fde0249a1048afb3262f81309f77412514 /lib/oxidized/model | |
| parent | 1ea8d56574a20df5196a7f20da368ab7e9bc53a8 (diff) | |
| parent | cbd6177479c8c6d9b8d55a4291bddba8390bab7d (diff) | |
Merge pull request #28 from thakala/master
Updates
Diffstat (limited to 'lib/oxidized/model')
| -rw-r--r-- | lib/oxidized/model/asa.rb | 48 | ||||
| -rw-r--r-- | lib/oxidized/model/fabricos.rb | 8 | 
2 files changed, 48 insertions, 8 deletions
| diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb new file mode 100644 index 0000000..3ee4e2d --- /dev/null +++ b/lib/oxidized/model/asa.rb @@ -0,0 +1,48 @@ +class ASA < Oxidized::Model + +  # Cisco ASA model # +  # Only SSH supported for the sake of security + +  prompt /^\r*([\w]+[#>]\s?)$/ +  comment  '! ' + +  cmd :all do |cfg| +    cfg.each_line.to_a[1..-2].join +  end + +  cmd :secret do |cfg| +    cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2' +    cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3' +    cfg +  end + +  cmd 'show clock' do |cfg| +    comment cfg +  end + +  cmd 'show version' do |cfg| +    comment cfg +  end + +  cmd 'show running-config' do |cfg| +    cfg = cfg.each_line.to_a[3..-1].join +    cfg.gsub! /^: [^\n]*\n/, '' +    cfg +  end + +  cmd 'show inventory' do |cfg| +    comment cfg +  end + +  cfg :ssh do +    if vars :enable +      post_login do +        send "enable\n" +        send vars(:enable) + "\n" +      end +    end +    post_login 'terminal pager 0' +    pre_logout 'exit' +  end + +end diff --git a/lib/oxidized/model/fabricos.rb b/lib/oxidized/model/fabricos.rb index 4854541..7ab9fd5 100644 --- a/lib/oxidized/model/fabricos.rb +++ b/lib/oxidized/model/fabricos.rb @@ -6,10 +6,6 @@ class FabricOS < Oxidized::Model    prompt /^([\w]+:+[\w]+[>]\s)$/    comment  '# ' -  cmd :all do |cfg| -    cfg -  end -    cmd 'chassisShow' do |cfg|      comment cfg    end @@ -22,8 +18,4 @@ class FabricOS < Oxidized::Model      exec true  # don't run shell, run each command in exec channel    end -  cfg :ssh do -    pre_logout 'exit' -  end -  end | 
