From 275e72ad7060c059916b61d738138981727afb4c Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Mon, 13 Jun 2016 09:22:05 +0000 Subject: Added Quanta OS --- lib/oxidized/model/quanta.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/oxidized/model/quanta.rb (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/quanta.rb b/lib/oxidized/model/quanta.rb new file mode 100644 index 0000000..870b772 --- /dev/null +++ b/lib/oxidized/model/quanta.rb @@ -0,0 +1,35 @@ +class Quanta < Oxidized::Model + + prompt /^\((\w|\S)+\) (>|#)$/ + comment '! ' + cmd 'show run' do |cfg| + cfg = cfg.each_line.select { |line| not line.match /^!.*$/ } + cfg = cfg.join + cfg = cfg.each_line.select { |line| not line.match /^\((\w|\S)+\) (>|#)$/ } + cfg = cfg.join + cfg = cfg.each_line.select { |line| not line.match /^show run$/ } + cfg = cfg.join + end + + cfg :telnet do + username /^Username:/ + password /^Password:/ + end + + cfg :telnet, :ssh do + post_login do + send "enable\n" + if vars :enable + cmd vars(:enable) + else + cmd "" + end + end + post_login 'terminal length 0' + pre_logout do + send "quit\n" + send "n\n" + end + end + +end -- cgit v1.2.1 From 6708cf6840376ede02c645749a2627f13255662b Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Mon, 13 Jun 2016 12:30:45 +0000 Subject: Update quanta.rb Updated match lines --- lib/oxidized/model/quanta.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/quanta.rb b/lib/oxidized/model/quanta.rb index 870b772..339c2d7 100644 --- a/lib/oxidized/model/quanta.rb +++ b/lib/oxidized/model/quanta.rb @@ -2,13 +2,13 @@ class Quanta < Oxidized::Model prompt /^\((\w|\S)+\) (>|#)$/ comment '! ' + cmd 'show run' do |cfg| - cfg = cfg.each_line.select { |line| not line.match /^!.*$/ } - cfg = cfg.join - cfg = cfg.each_line.select { |line| not line.match /^\((\w|\S)+\) (>|#)$/ } - cfg = cfg.join - cfg = cfg.each_line.select { |line| not line.match /^show run$/ } - cfg = cfg.join + cfg.each_line.select do |line| + not line.match /^!.*$/ and + not line.match /^\((\w|\S)+\) (>|#)$/ and + not line.match /^show run$/ + end.join end cfg :telnet do -- cgit v1.2.1 From 5c470d33d5c114c07a41650009753b388643d57e Mon Sep 17 00:00:00 2001 From: Daniel Preussker Date: Mon, 13 Jun 2016 12:46:26 +0000 Subject: Update Quanta model name --- lib/oxidized/model/quanta.rb | 35 ----------------------------------- lib/oxidized/model/quantaos.rb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 lib/oxidized/model/quanta.rb create mode 100644 lib/oxidized/model/quantaos.rb (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/quanta.rb b/lib/oxidized/model/quanta.rb deleted file mode 100644 index 339c2d7..0000000 --- a/lib/oxidized/model/quanta.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Quanta < Oxidized::Model - - prompt /^\((\w|\S)+\) (>|#)$/ - comment '! ' - - cmd 'show run' do |cfg| - cfg.each_line.select do |line| - not line.match /^!.*$/ and - not line.match /^\((\w|\S)+\) (>|#)$/ and - not line.match /^show run$/ - end.join - end - - cfg :telnet do - username /^Username:/ - password /^Password:/ - end - - cfg :telnet, :ssh do - post_login do - send "enable\n" - if vars :enable - cmd vars(:enable) - else - cmd "" - end - end - post_login 'terminal length 0' - pre_logout do - send "quit\n" - send "n\n" - end - end - -end diff --git a/lib/oxidized/model/quantaos.rb b/lib/oxidized/model/quantaos.rb new file mode 100644 index 0000000..274440d --- /dev/null +++ b/lib/oxidized/model/quantaos.rb @@ -0,0 +1,35 @@ +class QuantaOS < Oxidized::Model + + prompt /^\((\w|\S)+\) (>|#)$/ + comment '! ' + + cmd 'show run' do |cfg| + cfg.each_line.select do |line| + not line.match /^!.*$/ and + not line.match /^\((\w|\S)+\) (>|#)$/ and + not line.match /^show run$/ + end.join + end + + cfg :telnet do + username /^Username:/ + password /^Password:/ + end + + cfg :telnet, :ssh do + post_login do + send "enable\n" + if vars :enable + cmd vars(:enable) + else + cmd "" + end + end + post_login 'terminal length 0' + pre_logout do + send "quit\n" + send "n\n" + end + end + +end -- cgit v1.2.1