From 81fc3a4b423d8ce9fe69def57007312a96db6f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= Date: Tue, 19 Sep 2017 16:28:41 +0200 Subject: Add support for Supermicro SSE-G48-TG4 This model (and possibly others) runs an OS with a different set of commands than the Supermicro model that already exists. --- lib/oxidized/model/supermicro2.rb | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/oxidized/model/supermicro2.rb (limited to 'lib') diff --git a/lib/oxidized/model/supermicro2.rb b/lib/oxidized/model/supermicro2.rb new file mode 100644 index 0000000..710603c --- /dev/null +++ b/lib/oxidized/model/supermicro2.rb @@ -0,0 +1,48 @@ +# Developed against: +# #show version +# Switch ID Hardware Version Firmware Version +# 0 SSE-G48-TG4 (P2-01) 1.0.16-9 + +class Supermicro2 < Oxidized::Model + prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) + + cfg :ssh do + post_login 'no cli pagignation' + pre_logout 'exit' + end + + cmd :all do |cfg| + # * Drop first line that contains the command, and the last line that + # contains a prompt + # * Strip carriage returns + cfg.delete("\r").each_line.to_a[1..-2].join + end + + cmd :secret do |cfg| + cfg.gsub(/^(snmp community) .*/, '\1 ') + end + + cmd 'show system information' do |cfg| + cfg.sub! /^Device Up Time.*\n/, '' + cfg.delete! "\r" + comment(cfg).gsub(/ +$/, '') + end + + cmd 'show running-config' do |cfg| + comment_next = 0 + cfg.each_line.map { |l| + next '' if l.match /^Building configuration/ + + if l.match /^Switch ID.*Hardware Version.*Firmware Version/ then + comment_next = 2 + end + + if comment_next > 0 then + comment_next -= 1 + next comment(l) + end + + l + }.join.gsub(/ +$/, '') + end +end -- cgit v1.2.1 From a302b12af7edb5960c9812a51fec529c132ac401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verch=C3=A8re?= Date: Tue, 17 Oct 2017 12:27:44 +0200 Subject: Handle Dell N2000 switches (dnos6) --- lib/oxidized/model/dnos.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/dnos.rb b/lib/oxidized/model/dnos.rb index a44630e..5c3cd53 100644 --- a/lib/oxidized/model/dnos.rb +++ b/lib/oxidized/model/dnos.rb @@ -5,6 +5,7 @@ class DNOS < Oxidized::Model comment '! ' cmd :all do |cfg| + cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, '' cfg.each_line.to_a[2..-2].join end @@ -22,6 +23,14 @@ class DNOS < Oxidized::Model comment cfg end + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show system' do |cfg| + comment cfg + end + cmd 'show running-config' do |cfg| cfg = cfg.each_line.to_a[3..-1].join cfg -- cgit v1.2.1 From 38e1f4216df5751e856e11532fc894ccfbd4010d Mon Sep 17 00:00:00 2001 From: mattie47 <4696925+mattie47@users.noreply.github.com> Date: Sun, 7 Jan 2018 10:32:52 +1300 Subject: model: Added Allied Telesis AW+ model (#936) * Create awplus.rb Added support for Allied Telesis AW+ switches and routers * Add support for Allied Telesis Alliedware Plus products * Add Allied Telesis to Supported Products * Add Allied Telesis to supported models Feature support included: - Telnet and SSH -- Enable/Secret Password - Device info from "show system" command -- Dynamic output e.g. Device Uptime is removed. - Var: remove_secret - User-defined terminal length -- User is not required to "terminal no length" and can keep configured pager length. --- lib/oxidized/model/awplus.rb | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 lib/oxidized/model/awplus.rb (limited to 'lib') diff --git a/lib/oxidized/model/awplus.rb b/lib/oxidized/model/awplus.rb new file mode 100644 index 0000000..1d8fbcd --- /dev/null +++ b/lib/oxidized/model/awplus.rb @@ -0,0 +1,85 @@ +class AWPlus < Oxidized::Model + + #Allied Telesis Alliedware Plus Model# + #https://www.alliedtelesis.com/products/software/AlliedWare-Plus + + prompt /^(\r?[\w.@:\/-]+[#>]\s?)$/ + comment '! ' + + #Avoids needing "term length 0" to display full config file. + expect /--More--/ do |data, re| + send ' ' + data.sub re, '' + end + + #Removes gibberish pager output e.g. VT100 escape codes + cmd :all do |cfg| + cfg.gsub! /\e\[K/, '' # example how to handle pager - cleareol EL0 + cfg.gsub! /\e\[7m\e\[m/, '' # example how to handle pager - Reverse SGR7 + cfg.gsub! /\r/, '' # Filters rogue ^M - see issue #415 + cfg.each_line.to_a[1..-2].join + end + + #Remove passwords from config file. + #Add vars "remove_secret: true" to global oxidized config file to enable. + + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 ' + cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1