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 4203e00cbde157e767e8be39ffdcecb30db14e6b Mon Sep 17 00:00:00 2001 From: Nicholas Meredith Date: Sun, 12 Nov 2017 05:48:55 +1000 Subject: fix: Fix prompt pattern for model/comware.rb to handle ASCII Bell response +fix minor README.md typo (#1094) * comware.rb: update prompt to work when trailing ^G ASCII 7 (bell) is sent * README.md: correct typo 'HTT' to 'HTTP' for Configuration / Outputs paragraph * model/comware.rb: cleaning out some comments --- lib/oxidized/model/comware.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb index d926854..a5b7190 100644 --- a/lib/oxidized/model/comware.rb +++ b/lib/oxidized/model/comware.rb @@ -1,8 +1,8 @@ class Comware < Oxidized::Model # HP (A-series)/H3C/3Com Comware - # sometimes the prompt might have a leading nul - prompt /^\0*(<[\w.-]+>)$/ + # sometimes the prompt might have a leading nul or trailing ASCII Bell (^G) + prompt /^\0*(<[\w.-]+>).?$/ comment '# ' # example how to handle pager -- cgit v1.2.1 From 40cfa7b7cfba0d0a655fe2148ad9336414e89737 Mon Sep 17 00:00:00 2001 From: pv2b Date: Wed, 15 Nov 2017 23:02:27 +0100 Subject: fix: Netgear model: Permit . as valid character in prompt (#1099) --- lib/oxidized/model/netgear.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb index 38aaca7..0ab1349 100644 --- a/lib/oxidized/model/netgear.rb +++ b/lib/oxidized/model/netgear.rb @@ -1,7 +1,7 @@ class Netgear < Oxidized::Model comment '!' - prompt /^(\([\w-]+\)\s[#>])$/ + prompt /^(\([\w\-.]+\)\s[#>])$/ cmd :secret do |cfg| cfg.gsub!(/password (\S+)/, 'password ') -- cgit v1.2.1 From 8bef76580a3e848836f3f12fe9e6c50380dbe01e Mon Sep 17 00:00:00 2001 From: pv2b Date: Sat, 18 Nov 2017 10:59:28 +0100 Subject: model: Procurve Handle switch selection for stack commanders (#1104) When trying to connect to a HP Procurve Switch with stacking enabled, you are asked to choose which switch to connect to to manage. This patch makes it so that if this question is encountered, just press "Enter" to choose the stack commander. This won't make backing up stack members work (they still need to be configured seperately and given IP addresses, making stacking useless) but at least it makes it possible to back up a commander in a stack seperately. Fixed #1070 Credit to @stiltzkin10 for this fix. --- lib/oxidized/model/procurve.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 180b703..11d7ea9 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -21,6 +21,11 @@ class Procurve < Oxidized::Model "" end + expect /Enter switch number/ do + send "\n" + "" + end + cmd :all do |cfg| cfg = cfg.each_line.to_a[1..-2].join cfg = cfg.gsub /^\r/, '' -- cgit v1.2.1 From 115764f3b2d20b3732a8d81c38afaea19c11dad8 Mon Sep 17 00:00:00 2001 From: pv2b Date: Mon, 20 Nov 2017 09:16:44 +0100 Subject: feature: Added model information to exec hook (#1105) * Add OX_NODE_MODEL to exec hook * Update docs to reflect added OX_NODE_MSG to hook --- lib/oxidized/hook/exec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/hook/exec.rb b/lib/oxidized/hook/exec.rb index a9a5950..3f984c2 100644 --- a/lib/oxidized/hook/exec.rb +++ b/lib/oxidized/hook/exec.rb @@ -71,6 +71,7 @@ class Exec < Oxidized::Hook "OX_NODE_FROM" => ctx.node.from.to_s, "OX_NODE_MSG" => ctx.node.msg.to_s, "OX_NODE_GROUP" => ctx.node.group.to_s, + "OX_NODE_MODEL" => ctx.node.model.class.name, "OX_REPO_COMMITREF" => ctx.commitref.to_s, "OX_REPO_NAME" => ctx.node.repo.to_s, ) -- cgit v1.2.1 From 99220b9947946d5ad1e53cba6a343e942ce0c498 Mon Sep 17 00:00:00 2001 From: pv2b Date: Tue, 21 Nov 2017 09:03:48 +0100 Subject: model: Added support for Opnsense (#1111) * Add OPNsense model * Fix class name * Mention support for OPNsense in Supported OS types --- lib/oxidized/model/opnsense.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/oxidized/model/opnsense.rb (limited to 'lib') diff --git a/lib/oxidized/model/opnsense.rb b/lib/oxidized/model/opnsense.rb new file mode 100644 index 0000000..b874fca --- /dev/null +++ b/lib/oxidized/model/opnsense.rb @@ -0,0 +1,21 @@ +class OpnSense < Oxidized::Model + + # minimum required permissions: "System: Shell account access" + # must enable SSH and password-based SSH access + + cmd :all do |cfg| + cfg.each_line.to_a[1..-1].join + end + + cmd 'cat /conf/config.xml' do |cfg| + cfg.gsub! /\s\s*