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 7445e7ae80aa291a816fdae5fbec0594401ea9c9 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 17 Mar 2018 12:13:43 +0100 Subject: restore backward compatibility with a supermicro shim --- lib/oxidized/model/supermicro.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/oxidized/model/supermicro.rb (limited to 'lib') diff --git a/lib/oxidized/model/supermicro.rb b/lib/oxidized/model/supermicro.rb new file mode 100644 index 0000000..9cfa0a3 --- /dev/null +++ b/lib/oxidized/model/supermicro.rb @@ -0,0 +1,7 @@ +# Backward compatibility shim for deprecated model `supermicro`. +# Migrate your source from `supermicro` to `edgecos`. + +require_relative 'edgecos.rb' + +Supermicro = EdgeCOS + -- cgit v1.2.1 From 640bdb90f096334d3c6a6e2dd7fce8d34c1fba96 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 17 Mar 2018 12:44:01 +0100 Subject: complain when backward compatibility shim is used --- lib/oxidized/model/supermicro.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/supermicro.rb b/lib/oxidized/model/supermicro.rb index 9cfa0a3..518ae41 100644 --- a/lib/oxidized/model/supermicro.rb +++ b/lib/oxidized/model/supermicro.rb @@ -5,3 +5,5 @@ require_relative 'edgecos.rb' Supermicro = EdgeCOS +Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead." + -- cgit v1.2.1 From 9862cff359d6abc7bdc260600acd293d2d85dd2b Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 17 Mar 2018 13:04:20 +0100 Subject: restore dev comment of @tobbez to aricentiss model --- lib/oxidized/model/aricentiss.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/aricentiss.rb b/lib/oxidized/model/aricentiss.rb index 8675263..60c2f48 100644 --- a/lib/oxidized/model/aricentiss.rb +++ b/lib/oxidized/model/aricentiss.rb @@ -1,3 +1,8 @@ +# Developed against: +# #show version +# Switch ID Hardware Version Firmware Version +# 0 SSE-G48-TG4 (P2-01) 1.0.16-9 + class AricentISS < Oxidized::Model prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) -- cgit v1.2.1 From 2978d671a195a024893150cdf27b8a136d18e003 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 17 Mar 2018 13:24:02 +0100 Subject: correct typo in command to disable pagination --- lib/oxidized/model/aricentiss.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/aricentiss.rb b/lib/oxidized/model/aricentiss.rb index 60c2f48..80735c7 100644 --- a/lib/oxidized/model/aricentiss.rb +++ b/lib/oxidized/model/aricentiss.rb @@ -8,7 +8,7 @@ class AricentISS < Oxidized::Model prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) cfg :ssh do - post_login 'no cli pagignation' + post_login 'no cli pagination' pre_logout 'exit' end -- cgit v1.2.1