diff options
author | ytti <saku@ytti.fi> | 2016-05-25 15:17:04 +0300 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2016-05-25 15:17:04 +0300 |
commit | 68a0517b83459c16da4e2c4e21fb39c5b1382f38 (patch) | |
tree | 3337f9ff11ba7934301779d420190e5a1db32c15 | |
parent | 65273f736ce059fbb3785e251f65a3f84b387ef1 (diff) | |
parent | 3c2f1f8e923bca016f5df69e4953d865562f587b (diff) |
Merge pull request #330 from Ham5ter/master
Adds support for Mellanox Switch devices
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lib/oxidized/model/mlnxos.rb | 43 |
2 files changed, 45 insertions, 0 deletions
@@ -101,6 +101,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * Juniper * JunOS * ScreenOS (Netscreen) + * Mellanox + * MLNX-OS * Mikrotik * RouterOS * Motorola diff --git a/lib/oxidized/model/mlnxos.rb b/lib/oxidized/model/mlnxos.rb new file mode 100644 index 0000000..9542c88 --- /dev/null +++ b/lib/oxidized/model/mlnxos.rb @@ -0,0 +1,43 @@ +class MLNXOS < Oxidized::Model + + prompt /([\w.@()-\[:\s\]]+[#>]\s)$/ + comment '## ' + + # Pager Handling + expect /.+lines\s\d+\-\d+([\s]|\/\d+\s\(END\)\s).+$/ do |data, re| + send ' ' + data.sub re, '' + end + + cmd :all do |cfg| + cfg.gsub! /\[\?1h=\r/, '' # Pager Handling + cfg.gsub! /\r\[K/,'' # Pager Handling + cfg.gsub! /\s/, '' # Linebreak Handling + cfg = cfg.lines.to_a[2..-3].join + end + + cmd :secret do |cfg| + cfg.gsub! /(snmp-server community).*/, ' <snmp-server community configuration removed>' + cfg.gsub! /username (\S+) password (\d+) (\S+).*/, '<secret hidden>' + cfg + end + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show inventory' do |cfg| + comment cfg + end + + cmd 'enable' + + cmd 'show running-config' do |cfg| + cfg + end + + cfg :ssh do + password /^Password:\s*/ + pre_logout 'exit' + end +end |