summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/Supported-OS-Types.md3
-rw-r--r--lib/oxidized/model/supermicro2.rb48
2 files changed, 50 insertions, 1 deletions
diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md
index e600040..f5352de 100644
--- a/docs/Supported-OS-Types.md
+++ b/docs/Supported-OS-Types.md
@@ -128,7 +128,8 @@
* Siklu
* [EtherHaul](lib/oxidized/model/siklu.rb)
* Supermicro
- * [Supermicro](lib/oxidized/model/supermicro.rb)
+ * [Supermicro](lib/oxidized/model/supermicro.rb): Known to work with the Supermicro SSE-G2252.
+ * [Supermicro2](lib/oxidized/model/supermicro2.rb): Known to work with the Supermicro SSE-G48-TG4.
* Symantec
* [Blue Coat ProxySG / Security Gateway OS (SGOS)](lib/oxidized/model/sgos.rb)
* Trango Systems
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 <hidden>')
+ 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