From 0f3a828190e4278cafaa72af098d87d90d874809 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sun, 24 Aug 2014 16:01:32 +0300 Subject: Add ExtremeXOS --- lib/oxidized/model/xos.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/oxidized/model/xos.rb (limited to 'lib') diff --git a/lib/oxidized/model/xos.rb b/lib/oxidized/model/xos.rb new file mode 100644 index 0000000..a8292ca --- /dev/null +++ b/lib/oxidized/model/xos.rb @@ -0,0 +1,40 @@ +class XOS < Oxidized::Model + + # Extreme Networks XOS + + prompt /^*?[\w .-]+# $/ + comment '# ' + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join.rstrip + end + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show diagnostics' do |cfg| + comment cfg + end + + cmd 'show licenses' do |cfg| + comment cfg + end + + cmd 'show switch'do |cfg| + comment cfg.each_line.reject { |line| line.match /Time:/ or line.match /boot/i }.join + end + + cmd 'show configuration' + + cfg :telnet do + username /^login:/ + password /^passowrd:/ + end + + cfg :telnet, :ssh do + post_login 'disable clipaging' + pre_logout 'exit' + end + +end -- cgit v1.2.1 From 5662795ca35444a3e48eea3c2d8020d63502da84 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sun, 24 Aug 2014 16:25:30 +0300 Subject: Add Brocade NOS --- lib/oxidized/model/nos.rb | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/oxidized/model/nos.rb (limited to 'lib') diff --git a/lib/oxidized/model/nos.rb b/lib/oxidized/model/nos.rb new file mode 100644 index 0000000..c2f4319 --- /dev/null +++ b/lib/oxidized/model/nos.rb @@ -0,0 +1,45 @@ +class NOS < Oxidized::Model + + # Brocade Network Operating System + + prompt /^(?:\e\[..h)?[\w.-]+# $/ + comment '! ' + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join + end + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show inventory' do |cfg| + comment cfg + end + + cmd 'show license' do |cfg| + comment cfg + end + + cmd 'show chassis' do |cfg| + comment cfg.each_line.reject { |line| line.match /Time/ }.join + end + + cfg 'show system' do |cfg| + commen cfg.each_line.reject { |line| line.match /Time/ or line.match /speed/ } + end + + cmd 'show running-config' + + cfg :telnet do + username /^.* login: / + username /^Password:/ + end + + cfg :telnet, :ssh do + post_login 'terminal length 0' + #post_login 'terminal width 0' + pre_logout 'exit' + end + +end -- cgit v1.2.1 From cae7076eeed2b3b5fcfecffde17bcb85d8013af2 Mon Sep 17 00:00:00 2001 From: Jari Salo Date: Mon, 25 Aug 2014 16:54:35 +0300 Subject: Match IP address explicitly - New method node_want? - Don't match node to node[:name] if node[:name] is an ip address. Otherwise we might match to wrong ip address. --- lib/oxidized/nodes.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index 6f30af4..227f656 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -9,16 +9,11 @@ module Oxidized def load node_want=nil with_lock do new = [] - node_want_ip = (IPAddr.new(node_want) rescue false) if node_want @source = CFG.source.default Oxidized.mgr.add_source @source Oxidized.mgr.source[@source].new.load.each do |node| - # we want to load specific node(s), not all of them - if node_want - next unless node_want_ip == node[:ip] or node_want.match(node[:name]) - end - + next unless node_want? node_want, node begin _node = Node.new node new.push _node @@ -33,6 +28,19 @@ module Oxidized end end + def node_want? node_want, node + node_want_ip = (IPAddr.new(node_want) rescue false) + name_is_ip = (IPAddr.new(node[:name]) rescue false) + if name_is_ip and node_want_ip == node[:name] + true + elsif node[:ip] and node_want_ip == node[:ip] + true + elsif node_want.match node[:name] + true unless name_is_ip + end + end + + def list with_lock do map { |e| e.serialize } -- cgit v1.2.1 From 3a24cc5ba5af14bff128c512a039abbfe5266bfa Mon Sep 17 00:00:00 2001 From: Jari Salo Date: Mon, 25 Aug 2014 18:54:45 +0300 Subject: Return true if node_want is nil - Otherwise all nodes can not be loaded. --- lib/oxidized/nodes.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/oxidized/nodes.rb b/lib/oxidized/nodes.rb index 227f656..032118d 100644 --- a/lib/oxidized/nodes.rb +++ b/lib/oxidized/nodes.rb @@ -29,6 +29,7 @@ module Oxidized end def node_want? node_want, node + return true unless node_want node_want_ip = (IPAddr.new(node_want) rescue false) name_is_ip = (IPAddr.new(node[:name]) rescue false) if name_is_ip and node_want_ip == node[:name] -- cgit v1.2.1 From 4eb1eb2cf9ae0701b6d51a1601b4049e825791d8 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Sat, 30 Aug 2014 11:42:45 +0300 Subject: Remove ntp clock-period completely emj complained that it sometimes pops in, sometimes pops out. I guess really no point having it there. --- lib/oxidized/model/ios.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb index d2b4996..6fa3c5c 100644 --- a/lib/oxidized/model/ios.rb +++ b/lib/oxidized/model/ios.rb @@ -37,9 +37,9 @@ class IOS < Oxidized::Model end cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[3..-1].join + cfg = cfg.each_line.to_a[3..-1] + cfg = cfg.reject { |line| line.match /^ntp clock-period / }.join cfg.gsub! /^Current configuration : [^\n]*\n/, '' - cfg.sub! /^(ntp clock-period).*/, '! \1' cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*( (?:\ [^\n]*\n*)* tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1' -- cgit v1.2.1 From 2914f792870c9bf5c5b09d41e0f64d86f15403fb Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 22 Sep 2014 22:08:12 +0200 Subject: Fixed small bug in powerconnect enable code --- lib/oxidized/model/powerconnect.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 1d0352e..8c677b3 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -31,8 +31,10 @@ class PowerConnect < Oxidized::Model cfg :telnet, :ssh do if vars :enable - send "enable\n" - send vars(:enable) + "\n" + post_login do + send "enable\n" + send vars(:enable) + "\n" + end end post_login "terminal length 0" -- cgit v1.2.1 From 4a57251c79719a1bedbfe73d8cb5171ff48285cd Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 22 Sep 2014 22:08:53 +0200 Subject: Added model for cisco NXOS --- lib/oxidized/model/nxos.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/oxidized/model/nxos.rb (limited to 'lib') diff --git a/lib/oxidized/model/nxos.rb b/lib/oxidized/model/nxos.rb new file mode 100644 index 0000000..6163724 --- /dev/null +++ b/lib/oxidized/model/nxos.rb @@ -0,0 +1,23 @@ +class NXOS < Oxidized::Model + + prompt /^(\r?[\w.@_()-]+[#]\s?)$/ + comment '! ' + + cmd 'show version' do |cfg| + cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) } + comment cfg.join "" + end + + cmd 'show inventory' do |cfg| + comment cfg + end + + cmd 'show running-config' do |cfg| + cfg.gsub! /^!Time:[^\n]*\n/, '' + end + + cfg :ssh do + post_login 'terminal length 0' + pre_logout 'exit' + end +end -- cgit v1.2.1 From 49b7ec647b3050d35e8162afb63c7c43333f0ee5 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 26 Sep 2014 09:51:29 +0200 Subject: Removed ever-changing output from powerconnect model, thanks @artmann --- lib/oxidized/model/powerconnect.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 8c677b3..6a743db 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -18,8 +18,9 @@ class PowerConnect < Oxidized::Model end cmd 'show system' do |cfg| - cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) } - comment cfg.join "\n" + cfg = cfg.split("\n").select { |line| not line[/Up Time/] } + cfg = cfg[0..-28]<<" " + comment cfg.join("\n") end cmd 'show running-config' -- cgit v1.2.1 From 5bc5aa28a205c300e80956a257372bc2a6fcf6a7 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 2 Oct 2014 11:50:30 +0200 Subject: Fixed more ever changing output in powerconnect model, only shows up on some firmware versions --- lib/oxidized/model/powerconnect.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index 6a743db..a1fe229 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -14,11 +14,12 @@ class PowerConnect < Oxidized::Model end cmd 'show version' do |cfg| - comment cfg + cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] } + comment cfg.join("\n") + "\n" end cmd 'show system' do |cfg| - cfg = cfg.split("\n").select { |line| not line[/Up Time/] } + cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] } cfg = cfg[0..-28]<<" " comment cfg.join("\n") end -- cgit v1.2.1 From 34c4559c845bd6ba239bbf1013fcebbd8041e6c3 Mon Sep 17 00:00:00 2001 From: Stefan Schlesinger Date: Thu, 23 Oct 2014 18:11:31 +0200 Subject: model/asa: fixing prompt - hostname regex taken from ios model --- lib/oxidized/model/asa.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index 3ee4e2d..b2c3e01 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -3,7 +3,7 @@ class ASA < Oxidized::Model # Cisco ASA model # # Only SSH supported for the sake of security - prompt /^\r*([\w]+[#>]\s?)$/ + prompt /^\r*([\w.@()-]+[#>]\s?)$/ comment '! ' cmd :all do |cfg| -- cgit v1.2.1 From 764ebd865a8360057dea1b913cd41d6361e0a01f Mon Sep 17 00:00:00 2001 From: Stefan Schlesinger Date: Thu, 23 Oct 2014 18:59:44 +0200 Subject: model/asa: removing >show clock and ignoring uptime in >show version --- lib/oxidized/model/asa.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index b2c3e01..11db547 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -16,11 +16,10 @@ class ASA < Oxidized::Model cfg end - cmd 'show clock' do |cfg| - comment cfg - end - cmd 'show version' do |cfg| + # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours + cfg = cfg.each_line.select { |line| not line.match /\s+up\s+\d+\s+/ } + cfg = cfg.join comment cfg end -- cgit v1.2.1 From c59b4b5c0605f5f09721bc04d48c1894dfc7694d Mon Sep 17 00:00:00 2001 From: Stefan Schlesinger Date: Mon, 27 Oct 2014 17:26:40 +0100 Subject: model/asa: ASA prompt contains HA Failover state separated by slashes --- lib/oxidized/model/asa.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index 11db547..8335b1d 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -3,7 +3,7 @@ class ASA < Oxidized::Model # Cisco ASA model # # Only SSH supported for the sake of security - prompt /^\r*([\w.@()-]+[#>]\s?)$/ + prompt /^\r*([\w.@()-\/]+[#>]\s?)$/ comment '! ' cmd :all do |cfg| -- cgit v1.2.1