summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/mlnxos.rb
diff options
context:
space:
mode:
authorHam5ter <hans-christian.stein@web.de>2016-05-25 13:55:55 +0200
committerHam5ter <hans-christian.stein@web.de>2016-05-25 13:55:55 +0200
commitbc4791b8840f60b7ce3404b1c54d8bc854273d44 (patch)
tree8c43d5723253e5ce530d8ef69b8c445eeb216f04 /lib/oxidized/model/mlnxos.rb
parentc57839ef843d6a70cac8dca1ca2a9664cb2bf0d4 (diff)
Renames the Class and File to "MLNXOS"
The Official Name of the Operating System is "MLNX-OS" I changed the Name to "MLNXOS" because Ruby does not support "-" in Class Names. http://www.mellanox.com/page/mlnx_os
Diffstat (limited to 'lib/oxidized/model/mlnxos.rb')
-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