From 2e9563eedf8dabb53a0cd3fe0ca1a1b0055c561c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 31 Oct 2016 16:14:37 +0100 Subject: add Planet SGS switches --- lib/oxidized/model/planetsgs.rb | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 lib/oxidized/model/planetsgs.rb (limited to 'lib') diff --git a/lib/oxidized/model/planetsgs.rb b/lib/oxidized/model/planetsgs.rb new file mode 100644 index 0000000..c240237 --- /dev/null +++ b/lib/oxidized/model/planetsgs.rb @@ -0,0 +1,63 @@ +class PlanetSGS < 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+).*/, '