summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/mlnx.rb
diff options
context:
space:
mode:
authorChristian Stein <christian.stein@innovo-cloud.de>2016-02-19 13:45:03 +0100
committerChristian Stein <christian.stein@innovo-cloud.de>2016-02-19 13:45:03 +0100
commitc57839ef843d6a70cac8dca1ca2a9664cb2bf0d4 (patch)
treea7d457ebe8a4021e8d8f24360e28f3b2607cff22 /lib/oxidized/model/mlnx.rb
parent370d90bddd1c8c086c455175fdb88de5931a99d1 (diff)
adds support for Mellanox Switch devices
Diffstat (limited to 'lib/oxidized/model/mlnx.rb')
-rw-r--r--lib/oxidized/model/mlnx.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/oxidized/model/mlnx.rb b/lib/oxidized/model/mlnx.rb
new file mode 100644
index 0000000..02b7ab9
--- /dev/null
+++ b/lib/oxidized/model/mlnx.rb
@@ -0,0 +1,43 @@
+class MLNX < 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