From eaaef17151017210bb20a936c89b43584914f92c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 10 Nov 2016 22:19:40 +0100 Subject: add support for PLANET SG switches So far, only SGS switches were supported. Now, we check the model type during the 'show version' command, and only execute the 'show transceiver details' command in case an SGS switch was detected (as its not supported on SG models). We will also strip lines containing the current System Time and Uptime. These only appear on SG models, but it's a good idea to strip them anyways. --- lib/oxidized/model/planet.rb | 83 +++++++++++++++++++++++++++++++++++++++++ lib/oxidized/model/planetsgs.rb | 63 ------------------------------- 2 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 lib/oxidized/model/planet.rb delete mode 100644 lib/oxidized/model/planetsgs.rb (limited to 'lib') diff --git a/lib/oxidized/model/planet.rb b/lib/oxidized/model/planet.rb new file mode 100644 index 0000000..05a369a --- /dev/null +++ b/lib/oxidized/model/planet.rb @@ -0,0 +1,83 @@ +class Planet < Oxidized::Model + + prompt /^\r?([\w.@()-]+[#>]\s?)$/ + comment '! ' + + # example how to handle pager + #expect /^\s--More--\s+.*$/ do |data, re| + # send ' ' + # data.sub re, '' + #end + + # non-preferred way to handle additional PW prompt + #expect /^[\w.]+>$/ do |data| + # send "enable\n" + # send vars(:enable) + "\n" + # data + #end + + cmd :all do |cfg| + #cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager + #cfg.gsub! /\cH+/, '' # example how to handle pager + cfg.each_line.to_a[1..-2].join + end + + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 ' + cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '