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 fd1b2c2ac903b3a8e2578a4ca0f48a61309a0493 Mon Sep 17 00:00:00 2001 From: Ilya Demyanov Date: Sun, 31 Dec 2017 09:19:49 +0300 Subject: Create snr.rb --- lib/oxidized/model/snr.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/oxidized/model/snr.rb (limited to 'lib') diff --git a/lib/oxidized/model/snr.rb b/lib/oxidized/model/snr.rb new file mode 100644 index 0000000..3f1fab5 --- /dev/null +++ b/lib/oxidized/model/snr.rb @@ -0,0 +1,14 @@ +class SNR < Oxidized::Model + + comment '!' + + cmd 'show running-config' do |cfg| + cfg = cfg.each_line.to_a[1..-1] + end + + cfg :ssh do + post_login 'terminal length 0' + pre_logout 'exit' + end + +end -- cgit v1.2.1 From 9a134db581c8618c703b35960796e9b4b14c2be3 Mon Sep 17 00:00:00 2001 From: Alexandre-io Date: Thu, 12 Oct 2017 18:29:36 +0200 Subject: Fix prompt pattern for firewareos clusters and standalone --- lib/oxidized/model/firewareos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/firewareos.rb b/lib/oxidized/model/firewareos.rb index f456c60..1b3d07c 100644 --- a/lib/oxidized/model/firewareos.rb +++ b/lib/oxidized/model/firewareos.rb @@ -1,6 +1,6 @@ class FirewareOS < Oxidized::Model - prompt /^([\w.@-]+[#>]\s?)$/ + prompt /^\[?\w*\]?\w*?(<\w*>)?(#|>)\s*$/ comment '-- ' cmd :all do |cfg| -- cgit v1.2.1 From 3836597f38d7dd34ac164857e317560af4206fd1 Mon Sep 17 00:00:00 2001 From: Thane Gill Date: Fri, 9 Feb 2018 12:41:39 -0800 Subject: model: AWOS Make the space between # mandatory rather than optional in the prompt. (#1182) Per discussion in #1000 --- lib/oxidized/model/aosw.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb index a85ead7..71fde2e 100644 --- a/lib/oxidized/model/aosw.rb +++ b/lib/oxidized/model/aosw.rb @@ -11,7 +11,7 @@ class AOSW < Oxidized::Model # All IAPs connected to a Instant Controller will have the same config output. Only the controller needs to be monitored. comment '# ' - prompt /^\(?.+\)?\s?[#>]/ + prompt /^\(?.+\)?\s[#>]/ cmd :all do |cfg| cfg.each_line.to_a[1..-2].join -- cgit v1.2.1 From a9e5eed60b687b4a488eb1d11b5147e9f932c6fa Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 10 Feb 2018 17:10:23 -0500 Subject: mode: Procurve model add show commands (#1176) Sanitized output: ``` Power Supply Status: PS# Model State AC/DC + V Wattage ---- --------- ------------- ----------------- --------- 1 Unknwn Powered AC 220V 1500 2 Unknwn Powered AC 220V 1500 2 / 2 supply bays delivering power. Total power: 3000 W ``` Of course you see `unknwn` but that is addressed in latest firmware release. Thanks! --- lib/oxidized/model/procurve.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 11d7ea9..444fb5b 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -47,6 +47,10 @@ class Procurve < Oxidized::Model comment cfg end + cmd 'show system power-supply' do |cfg| + comment cfg + end + cmd 'show interfaces transceiver' do |cfg| comment cfg end -- cgit v1.2.1 From a42d1bad82e37975d674b560b18bc153a2786669 Mon Sep 17 00:00:00 2001 From: dhooper6430 Date: Wed, 21 Feb 2018 17:25:49 +0800 Subject: model: Update br6910 model prompt detection (#1188) The BR6910 switch can be configured to display anything on the prompt, by default it's vty-, I have modified the prompt statement to allow for whatever the user has configured the prompt to be. --- lib/oxidized/model/br6910.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb index b5c9bcf..df93793 100644 --- a/lib/oxidized/model/br6910.rb +++ b/lib/oxidized/model/br6910.rb @@ -1,7 +1,7 @@ class BR6910 < Oxidized::Model - prompt /^Vty-[0-9]\#$/ + prompt /^([\w.@()-]+[#>]\s?)$/ comment '! ' # not possible to disable paging prior to show running-config -- cgit v1.2.1 From 72397c4f344ab97fe3db1e381a3e5e1b1a935c62 Mon Sep 17 00:00:00 2001 From: Jason Ackley Date: Tue, 27 Feb 2018 08:58:59 -0600 Subject: model: Added support for ArbOS from Arbor Networks. (#1096) * Basic support for ArbOS from Arbor Networks. ArbOS is the generic name for Arbor Networks (https://www.arbornetworks.com/) OS that runs on some of their devices. Found and imported from https://github.com/claranet/oxidized . Credit to Claranet for the creation. Locally validated on Peakflow SP v8.2+ The module is quite simple as the command 'config show' automatically disables pagination. There is a pagination-enabled version of the command as well. * Added model notes for ArbOS --- lib/oxidized/model/arbos.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/oxidized/model/arbos.rb (limited to 'lib') diff --git a/lib/oxidized/model/arbos.rb b/lib/oxidized/model/arbos.rb new file mode 100644 index 0000000..389f3f6 --- /dev/null +++ b/lib/oxidized/model/arbos.rb @@ -0,0 +1,27 @@ +class ARBOS < Oxidized::Model + + # Arbor OS model # + + prompt /^[\S\s]+\n([\w.@-]+[:\/#>]+)\s?$/ + comment '# ' + + cmd 'system hardware' do |cfg| + cfg.gsub! /^Boot\ time\:\s.+/, '' # Remove boot timer + cfg.gsub! /^Load\ averages\:\s.+/, '' # Remove CPU load info + cfg = cfg.each_line.to_a[2..-1].join + comment cfg + end + + cmd 'system version' do |cfg| + comment cfg + end + + cmd 'config show' do |cfg| + cfg + end + + cfg :ssh do + exec true + pre_logout 'exit' + end +end -- cgit v1.2.1 From 34cdbeb75f3c74d803fb60c509fc06e4f6365f0c Mon Sep 17 00:00:00 2001 From: Zachary Puls Date: Tue, 27 Feb 2018 09:22:32 -0600 Subject: model: Added "commands" flag to "show configuration" on VyOS/Vyatta/EdgeOS (#1164) --- lib/oxidized/model/edgeos.rb | 2 +- lib/oxidized/model/vyatta.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/edgeos.rb b/lib/oxidized/model/edgeos.rb index 2a8d663..bb0aab5 100644 --- a/lib/oxidized/model/edgeos.rb +++ b/lib/oxidized/model/edgeos.rb @@ -13,7 +13,7 @@ class Edgeos < Oxidized::Model cfg end - cmd 'show configuration | no-more' + cmd 'show configuration commands | no-more' cfg :telnet do username /login:\s/ diff --git a/lib/oxidized/model/vyatta.rb b/lib/oxidized/model/vyatta.rb index 8d977aa..aa0bc74 100644 --- a/lib/oxidized/model/vyatta.rb +++ b/lib/oxidized/model/vyatta.rb @@ -13,7 +13,7 @@ class Vyatta < Oxidized::Model cfg end - cmd 'show configuration | no-more' + cmd 'show configuration commands | no-more' cfg :telnet do username /login:\s/ -- cgit v1.2.1 From 692a5c0d61f4900c07b859afff5affa86ccb8505 Mon Sep 17 00:00:00 2001 From: Adam Furman Date: Sat, 10 Mar 2018 12:55:39 -0800 Subject: Add fortios fields to be masked by remove_secret flag --- lib/oxidized/model/fortios.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index bffaf3c..23370c4 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -15,7 +15,7 @@ class FortiOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /(set (?:passwd|password|psksecret|secret|key|group-password|secondary-secret|tertiary-secret|auth-password-l1|auth-password-l2|rsso|history0|history1|inter-controller-key ENC)).*/, '\\1 ' + cfg.gsub! /(set (?:passwd|password|psksecret|secret|key|group-password|secondary-secret|tertiary-secret|auth-password-l1|auth-password-l2|rsso|history0|history1|inter-controller-key ENC|passphrase ENC|login-passwd ENC)).*/, '\\1 ' cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 ' cfg.gsub! /(set ca ).*-+END CERTIFICATE-*"$/m , '\\1 ' cfg.gsub! /(set csr ).*-+END CERTIFICATE REQUEST-*"$/m , '\\1 ' @@ -63,4 +63,3 @@ cfg << cmd('end') if @vdom_enabled end end - -- cgit v1.2.1 From ad2a0675edee605bda8fe460b3656857eb050129 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 11 Mar 2018 23:11:13 +0100 Subject: Introduce support for OXIDIZED_SSH_PASSPHRASE --- lib/oxidized/hook/githubrepo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb index d33e54e..f74b22a 100644 --- a/lib/oxidized/hook/githubrepo.rb +++ b/lib/oxidized/hook/githubrepo.rb @@ -51,7 +51,7 @@ class GithubRepo < Oxidized::Hook else if cfg.has_key?('publickey') && cfg.has_key?('privatekey') log "Using ssh auth with key", :debug - Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey)) + Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"]) else log "Using ssh auth with agentforwarding", :debug Rugged::Credentials::SshKeyFromAgent.new(username: 'git') -- cgit v1.2.1 From 577128f962f02e81ce7664e32fb97a46f2c220e8 Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Thu, 15 Mar 2018 01:54:55 -0700 Subject: add removal of secrets in edgeos, vyatta --- lib/oxidized/model/edgeos.rb | 4 ++++ lib/oxidized/model/vyatta.rb | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/edgeos.rb b/lib/oxidized/model/edgeos.rb index bb0aab5..aa7a197 100644 --- a/lib/oxidized/model/edgeos.rb +++ b/lib/oxidized/model/edgeos.rb @@ -9,6 +9,10 @@ class Edgeos < Oxidized::Model end cmd :secret do |cfg| + cfg.gsub! /encrypted-password (\S+).*/, 'encrypted-password ' + cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password ' + cfg.gsub! /password (\S+).*/, 'password ' + cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret ' cfg.gsub! /community (\S+) {/, 'community {' cfg end diff --git a/lib/oxidized/model/vyatta.rb b/lib/oxidized/model/vyatta.rb index aa0bc74..57ec9d3 100644 --- a/lib/oxidized/model/vyatta.rb +++ b/lib/oxidized/model/vyatta.rb @@ -9,6 +9,10 @@ class Vyatta < Oxidized::Model end cmd :secret do |cfg| + cfg.gsub! /encrypted-password (\S+).*/, 'encrypted-password ' + cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password ' + cfg.gsub! /password (\S+).*/, 'password ' + cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret ' cfg.gsub! /community (\S+) {/, 'community {' cfg end -- cgit v1.2.1 From 05e1d505f2cc30e87b1cdcf90db966690882f610 Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Thu, 15 Mar 2018 02:18:38 -0700 Subject: add secrets to sanitize in JunOS --- lib/oxidized/model/junos.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 2f59414..4652ab1 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -13,7 +13,9 @@ class JunOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub!(/encrypted-password (\S+).*/, '') + cfg.gsub!(/encrypted-password (\S+).*/, 'encrypted-password ') + cfg.gsub!(/pre-shared-key ascii-text (\S+).*/, 'pre-shared-key ascii-text ') + cfg.gsub!(/authentication-key (\S+).*/, 'authentication-key ') cfg.gsub!(/community (\S+) {/, 'community {') cfg end -- cgit v1.2.1 From 227f1af00c6d43e9627fa2803d90617bebcd1d83 Mon Sep 17 00:00:00 2001 From: Adam Smith Date: Thu, 15 Mar 2018 02:23:45 -0700 Subject: add hexadecimal for junos pre-shared-secret --- lib/oxidized/model/junos.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 4652ab1..2ea0179 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -15,6 +15,7 @@ class JunOS < Oxidized::Model cmd :secret do |cfg| cfg.gsub!(/encrypted-password (\S+).*/, 'encrypted-password ') cfg.gsub!(/pre-shared-key ascii-text (\S+).*/, 'pre-shared-key ascii-text ') + cfg.gsub!(/pre-shared-key hexadecimal (\S+).*/, 'pre-shared-key hexadecimal ') cfg.gsub!(/authentication-key (\S+).*/, 'authentication-key ') cfg.gsub!(/community (\S+) {/, 'community {') cfg -- cgit v1.2.1 From dc28e4b352dde0b43656c93f852e744125dd708e Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Thu, 15 Mar 2018 19:57:33 +0000 Subject: Skip the word 'encrypted' in Powerconnect password masking Fixes #1212 --- lib/oxidized/model/powerconnect.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 61e1cf2..f602a36 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -14,7 +14,7 @@ class PowerConnect < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /^username (\S+) password \S+ (.*)/, 'username \1 password \2' + cfg.gsub! /^(username \S+ password (?:encrypted )?)\S+(.*)/, '\1\2' cfg 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 From d3c96a04c15ff0c6cae00d0721a6f5216357207f Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 17 Mar 2018 17:49:18 +0100 Subject: transition timos to sros --- lib/oxidized/model/sros.rb | 118 ++++++++++++++++++++++++++++++++++++++ lib/oxidized/model/supermicro.rb | 1 + lib/oxidized/model/timos.rb | 120 ++------------------------------------- 3 files changed, 125 insertions(+), 114 deletions(-) create mode 100644 lib/oxidized/model/sros.rb (limited to 'lib') diff --git a/lib/oxidized/model/sros.rb b/lib/oxidized/model/sros.rb new file mode 100644 index 0000000..289bed3 --- /dev/null +++ b/lib/oxidized/model/sros.rb @@ -0,0 +1,118 @@ +class SROS < Oxidized::Model + + # + # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent). + # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP. + # + + comment '# ' + + prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/ + + cmd :all do |cfg, cmdstring| + new_cfg = comment "COMMAND: #{cmdstring}\n" + new_cfg << cfg.each_line.to_a[1..-2].join + end + + # + # Show the boot options file. + # + cmd 'show bof' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the system information. + # + cmd 'show system information' do |cfg| + # + # Strip uptime. + # + cfg.sub! /^System Up Time.*\n/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the card state. + # + cmd 'show card state' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the boot log. + # + cmd 'file type bootlog.txt' do |cfg| + # + # Strip carriage returns and backspaces. + # + cfg.gsub! /\r/, '' + cfg.gsub! /[\b][\b][\b]/, "\n" + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the running debug configuration. + # + cmd 'show debug' do |cfg| + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the saved debug configuration (admin debug-save). + # + cmd 'file type config.dbg' do |cfg| + # + # Strip carriage returns. + # + cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the running persistent indices. + # + cmd 'admin display-config index' do |cfg| + # + # Strip carriage returns. + # + cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + comment cfg + end + + # + # Show the running configuration. + # + cmd 'admin display-config' do |cfg| + # + # Strip carriage returns. + # + cfg.gsub! /\r/, '' + cfg.gsub! /# Finished .*/, '' + cfg.gsub! /# Generated .*/, '' + end + + cfg :telnet do + username /^Login: / + password /^Password: / + end + + cfg :telnet, :ssh do + post_login 'environment no more' + pre_logout 'logout' + end +end diff --git a/lib/oxidized/model/supermicro.rb b/lib/oxidized/model/supermicro.rb index 518ae41..56d5ef6 100644 --- a/lib/oxidized/model/supermicro.rb +++ b/lib/oxidized/model/supermicro.rb @@ -7,3 +7,4 @@ Supermicro = EdgeCOS Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead." +# Deprecated diff --git a/lib/oxidized/model/timos.rb b/lib/oxidized/model/timos.rb index c230a8f..e454630 100644 --- a/lib/oxidized/model/timos.rb +++ b/lib/oxidized/model/timos.rb @@ -1,118 +1,10 @@ -class TiMOS < Oxidized::Model +# Backward compatibility shim for deprecated model `timos`. +# Migrate your source from `timos` to `sros`. - # - # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent). - # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP. - # +require_relative 'sros.rb' - comment '# ' +TiMOS = SROS - prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/ +Oxidized.logger.warn "Using deprecated model timos, use sros instead." - cmd :all do |cfg, cmdstring| - new_cfg = comment "COMMAND: #{cmdstring}\n" - new_cfg << cfg.each_line.to_a[1..-2].join - end - - # - # Show the boot options file. - # - cmd 'show bof' do |cfg| - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the system information. - # - cmd 'show system information' do |cfg| - # - # Strip uptime. - # - cfg.sub! /^System Up Time.*\n/, '' - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the card state. - # - cmd 'show card state' do |cfg| - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the boot log. - # - cmd 'file type bootlog.txt' do |cfg| - # - # Strip carriage returns and backspaces. - # - cfg.gsub! /\r/, '' - cfg.gsub! /[\b][\b][\b]/, "\n" - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the running debug configuration. - # - cmd 'show debug' do |cfg| - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the saved debug configuration (admin debug-save). - # - cmd 'file type config.dbg' do |cfg| - # - # Strip carriage returns. - # - cfg.gsub! /\r/, '' - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the running persistent indices. - # - cmd 'admin display-config index' do |cfg| - # - # Strip carriage returns. - # - cfg.gsub! /\r/, '' - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - comment cfg - end - - # - # Show the running configuration. - # - cmd 'admin display-config' do |cfg| - # - # Strip carriage returns. - # - cfg.gsub! /\r/, '' - cfg.gsub! /# Finished .*/, '' - cfg.gsub! /# Generated .*/, '' - end - - cfg :telnet do - username /^Login: / - password /^Password: / - end - - cfg :telnet, :ssh do - post_login 'environment no more' - pre_logout 'logout' - end -end +# Deprecated -- cgit v1.2.1 From 7c5ca77a2e0349b87128fa6d143f391a9204b0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= Date: Mon, 19 Mar 2018 12:11:21 +0100 Subject: AricentISS: Fix pagination for old OS versions Always issue both 'no cli pagination' and 'no cli pagignation'. Conditionally issuing only the correct variant would require sending the same number of commands to the switch ('show version', 'no cli pagi(g)nation') and also require extra logic in the model. Additionally, always issuing both removes the need for storing information about what OS versions require which command in the model. --- lib/oxidized/model/aricentiss.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/aricentiss.rb b/lib/oxidized/model/aricentiss.rb index 80735c7..8821801 100644 --- a/lib/oxidized/model/aricentiss.rb +++ b/lib/oxidized/model/aricentiss.rb @@ -8,7 +8,10 @@ class AricentISS < Oxidized::Model prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) cfg :ssh do + # "pagination" was misspelled in some (earlier) versions (at least 1.0.16-9) + # 1.0.18-15 is known to include the corrected spelling post_login 'no cli pagination' + post_login 'no cli pagignation' pre_logout 'exit' end -- cgit v1.2.1 From 343cf3227cafe4a7de4a7be5934163eb6bd2dba9 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Tue, 20 Mar 2018 23:17:29 +0100 Subject: expand dcnos model --- lib/oxidized/model/dcnos.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/oxidized/model/dcnos.rb b/lib/oxidized/model/dcnos.rb index 5a39e2b..4a33fa0 100644 --- a/lib/oxidized/model/dcnos.rb +++ b/lib/oxidized/model/dcnos.rb @@ -12,6 +12,14 @@ class DCNOS < Oxidized::Model comment cfg end + cmd 'show boot-files' do |cfg| + comment cfg + end + + cmd 'show flash' do |cfg| + comment cfg + end + cmd 'show running-config' do |cfg| cfg = cfg.each_line.to_a[1..-1] end -- cgit v1.2.1 From 2d8e40344a05ac16869941c19dbcd6df8ddac80c Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Tue, 20 Mar 2018 23:38:23 +0100 Subject: better comments --- lib/oxidized/model/dcnos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/dcnos.rb b/lib/oxidized/model/dcnos.rb index 4a33fa0..c6b2e36 100644 --- a/lib/oxidized/model/dcnos.rb +++ b/lib/oxidized/model/dcnos.rb @@ -6,7 +6,7 @@ class DCNOS < Oxidized::Model - comment '!' + comment '! ' cmd 'show version' do |cfg| comment cfg -- cgit v1.2.1 From 0878dd2ef1af0a731a647fc0fc4f3a245a0131a9 Mon Sep 17 00:00:00 2001 From: Uwe Werler Date: Wed, 21 Mar 2018 13:20:18 +0000 Subject: Update nxos.rb Otherwise the running config will not be stored. --- lib/oxidized/model/nxos.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/model/nxos.rb b/lib/oxidized/model/nxos.rb index e743415..60d6037 100644 --- a/lib/oxidized/model/nxos.rb +++ b/lib/oxidized/model/nxos.rb @@ -22,6 +22,7 @@ class NXOS < Oxidized::Model cmd 'show running-config' do |cfg| cfg.gsub! /^!Time:[^\n]*\n/, '' + cfg end cfg :ssh, :telnet do -- cgit v1.2.1 From 4ba96c79f7eaf5dd9c02c9488d77a5c896c96d8c Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Fri, 23 Mar 2018 09:24:38 +0100 Subject: yield cfg for clarity --- lib/oxidized/model/dcnos.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/dcnos.rb b/lib/oxidized/model/dcnos.rb index c6b2e36..f53bc0d 100644 --- a/lib/oxidized/model/dcnos.rb +++ b/lib/oxidized/model/dcnos.rb @@ -21,7 +21,8 @@ class DCNOS < Oxidized::Model end cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[1..-1] + cfg = cfg.each_line.to_a[1..-1].join + cfg end cfg :telnet do -- cgit v1.2.1 From 5ac9b61077ed1fcb5989b090dba79a0ef70fd2e7 Mon Sep 17 00:00:00 2001 From: Sascha Tetzel Date: Mon, 26 Mar 2018 10:00:50 +0000 Subject: Update hpebladesystem.rb - disable Last Update from NTP in Show Network, because it produced a new version with every backup (show network) - disable parsing of "----More----", it is better to user "Script Mode" (cfg :telnet, :ssh) -> post_login --- lib/oxidized/model/hpebladesystem.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/hpebladesystem.rb b/lib/oxidized/model/hpebladesystem.rb index 5e34de8..27673de 100644 --- a/lib/oxidized/model/hpebladesystem.rb +++ b/lib/oxidized/model/hpebladesystem.rb @@ -4,10 +4,10 @@ class HPEBladeSystem < Oxidized::Model prompt /.*> / comment '# ' - expect /^\s*--More--\s+.*$/ do |data, re| - send ' ' - data.sub re, '' - end + #expect /^\s*--More--\s+.*$/ do |data, re| + # send ' ' + # data.sub re, '' + #end cmd :all do |cfg| cfg = cfg.delete("\r").each_line.to_a[0..-1].map{|line|line.rstrip}.join("\n") + "\n" @@ -40,6 +40,7 @@ class HPEBladeSystem < Oxidized::Model end cmd 'show network' do |cfg| + cfg.gsub! /Last Update:.*$/i, '' comment cfg end @@ -78,6 +79,7 @@ class HPEBladeSystem < Oxidized::Model end cfg :telnet, :ssh do + post_login "set script mode on" pre_logout "exit" end end -- cgit v1.2.1 From b2fcf887b3ea7e85e916ec7265a494a6efbf8fa7 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Thu, 5 Apr 2018 14:23:20 +0200 Subject: strip uptime info from show version --- lib/oxidized/model/dcnos.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/model/dcnos.rb b/lib/oxidized/model/dcnos.rb index f53bc0d..ec0c7f6 100644 --- a/lib/oxidized/model/dcnos.rb +++ b/lib/oxidized/model/dcnos.rb @@ -9,6 +9,7 @@ class DCNOS < Oxidized::Model comment '! ' cmd 'show version' do |cfg| + cfg = cfg.gsub! /^(Uptime is ).*/, '' comment cfg end -- cgit v1.2.1 From b54a5e211f2127d9397e6d43c30fd47de33ee5a5 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Thu, 5 Apr 2018 15:29:00 +0200 Subject: unspeakable things took place in original PR, correcting model --- lib/oxidized/model/dcnos.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/dcnos.rb b/lib/oxidized/model/dcnos.rb index ec0c7f6..8506280 100644 --- a/lib/oxidized/model/dcnos.rb +++ b/lib/oxidized/model/dcnos.rb @@ -8,8 +8,12 @@ class DCNOS < Oxidized::Model comment '! ' + cmd :all do |cfg| + cfg.each_line.to_a[1..-1].join + end + cmd 'show version' do |cfg| - cfg = cfg.gsub! /^(Uptime is ).*/, '' + cfg.gsub! /\s(Uptime is).*/, '' comment cfg end @@ -22,7 +26,6 @@ class DCNOS < Oxidized::Model end cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[1..-1].join cfg end -- cgit v1.2.1 From 265e7f55d7bf481757b12218e893231a7d6e092e Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Fri, 6 Apr 2018 21:19:07 +0200 Subject: refactor githubrepo credential handling --- lib/oxidized/hook/githubrepo.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb index f74b22a..715438b 100644 --- a/lib/oxidized/hook/githubrepo.rb +++ b/lib/oxidized/hook/githubrepo.rb @@ -45,16 +45,23 @@ class GithubRepo < Oxidized::Hook private def credentials - @credentials ||= if cfg.has_key?('username') && cfg.has_key?('password') - log "Using https auth", :debug - Rugged::Credentials::UserPassword.new(username: cfg.username, password: cfg.password) - else - if cfg.has_key?('publickey') && cfg.has_key?('privatekey') - log "Using ssh auth with key", :debug - Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"]) + Proc.new do |url, username_from_url, allowed_types| + + if cfg.has_key?('username') + git_user = cfg.username + else + git_user = username_from_url ? username_from_url : 'git' + end + + if cfg.has_key?('password') + log "Authenticating using username and password", :debug + Rugged::Credentials::UserPassword.new(username: git_user, password: cfg.password) + elsif cfg.has_key?('publickey') && cfg.has_key?('privatekey') + log "Authenticating using ssh keys", :debug + Rugged::Credentials::SshKey.new(username: git_user, publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"]) else - log "Using ssh auth with agentforwarding", :debug - Rugged::Credentials::SshKeyFromAgent.new(username: 'git') + log "Authenticating using ssh agent", :debug + Rugged::Credentials::SshKeyFromAgent.new(username: git_user) end end end -- cgit v1.2.1 From 331838fd9203dcf72e94ea218defc9a2115fabf6 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Fri, 6 Apr 2018 22:12:18 +0200 Subject: expose username in debug log --- lib/oxidized/hook/githubrepo.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb index 715438b..4cae4e6 100644 --- a/lib/oxidized/hook/githubrepo.rb +++ b/lib/oxidized/hook/githubrepo.rb @@ -54,13 +54,13 @@ class GithubRepo < Oxidized::Hook end if cfg.has_key?('password') - log "Authenticating using username and password", :debug + log "Authenticating using username and password as '#{git_user}'", :debug Rugged::Credentials::UserPassword.new(username: git_user, password: cfg.password) elsif cfg.has_key?('publickey') && cfg.has_key?('privatekey') - log "Authenticating using ssh keys", :debug + log "Authenticating using ssh keys as '#{git_user}'", :debug Rugged::Credentials::SshKey.new(username: git_user, publickey: File.expand_path(cfg.publickey), privatekey: File.expand_path(cfg.privatekey), passphrase: ENV["OXIDIZED_SSH_PASSPHRASE"]) else - log "Authenticating using ssh agent", :debug + log "Authenticating using ssh agent as '#{git_user}'", :debug Rugged::Credentials::SshKeyFromAgent.new(username: git_user) end end -- cgit v1.2.1 From f3c489be3d747af4608234fb55d93d8d3e037470 Mon Sep 17 00:00:00 2001 From: Martin Overgaard Hansen Date: Sat, 7 Apr 2018 21:34:18 +0200 Subject: Allowed prompt to contain hyphen --- 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 8821801..14f8502 100644 --- a/lib/oxidized/model/aricentiss.rb +++ b/lib/oxidized/model/aricentiss.rb @@ -5,7 +5,7 @@ class AricentISS < Oxidized::Model - prompt (/^(\e\[27m)?[ \r]*\w+# ?$/) + prompt (/^(\e\[27m)?[ \r]*[\w-]+# ?$/) cfg :ssh do # "pagination" was misspelled in some (earlier) versions (at least 1.0.16-9) -- cgit v1.2.1 From 0bebd8cb9ea83b4933aca702b2734e6597271fec Mon Sep 17 00:00:00 2001 From: Andre Sencioles Date: Mon, 9 Apr 2018 09:39:56 +1200 Subject: Disable paging for "show full-configuration" on FortiOS --- lib/oxidized/model/fortios.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 23370c4..9287dce 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -49,7 +49,7 @@ class FortiOS < Oxidized::Model cfg << cmd('end') if @vdom_enabled - cfg << cmd('show full-configuration') + cfg << cmd('show full-configuration | grep .') cfg.join "\n" end -- cgit v1.2.1