From c57839ef843d6a70cac8dca1ca2a9664cb2bf0d4 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 19 Feb 2016 13:45:03 +0100 Subject: adds support for Mellanox Switch devices --- lib/oxidized/model/mlnx.rb | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/oxidized/model/mlnx.rb 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).*/, ' ' + cfg.gsub! /username (\S+) password (\d+) (\S+).*/, '