summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-05-25 15:17:04 +0300
committerytti <saku@ytti.fi>2016-05-25 15:17:04 +0300
commit68a0517b83459c16da4e2c4e21fb39c5b1382f38 (patch)
tree3337f9ff11ba7934301779d420190e5a1db32c15 /lib
parent65273f736ce059fbb3785e251f65a3f84b387ef1 (diff)
parent3c2f1f8e923bca016f5df69e4953d865562f587b (diff)
Merge pull request #330 from Ham5ter/master
Adds support for Mellanox Switch devices
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/model/mlnxos.rb43
1 files changed, 43 insertions, 0 deletions
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