From be2a66feda3350673dd2d963a203e1cc5d68a017 Mon Sep 17 00:00:00 2001 From: Marco Li Date: Wed, 9 May 2018 09:29:27 +0800 Subject: Create stoneos.rb Add new model of Hillstone Networks StoneOS software --- lib/oxidized/model/stoneos.rb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/oxidized/model/stoneos.rb (limited to 'lib/oxidized/model/stoneos.rb') diff --git a/lib/oxidized/model/stoneos.rb b/lib/oxidized/model/stoneos.rb new file mode 100644 index 0000000..405e389 --- /dev/null +++ b/lib/oxidized/model/stoneos.rb @@ -0,0 +1,38 @@ +class Stoneos < Oxidized::Model +#Hillstone Networks StoneOS software + + prompt /^\r?[\w.()-]+[#>](\s)?$/ + comment '# ' + + expect /^\s.*--More--.*$/ do |data, re| + send ' ' + data.sub re, '' + end + + cmd :all do |cfg| + cfg = cfg.lines.to_a[1..-2].join + end + + cmd :secret do |cfg| + cfg + end + + cmd 'show configuration running' do |cfg| + cfg + end + + cmd 'show version' do |cfg| + comment cfg + end + + cfg :telnet do + username(/^login:/) + password(/^Password:/) + end + + cfg :telnet, :ssh do + post_login 'terminal length 256' + post_login 'terminal width 512' + pre_logout 'exit' + end +end -- cgit v1.2.1 From 9273e5feee159040622348d922512dd6b2f097b9 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Wed, 9 May 2018 13:04:16 +0200 Subject: tidy up and add references for stoneos model --- lib/oxidized/model/stoneos.rb | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'lib/oxidized/model/stoneos.rb') diff --git a/lib/oxidized/model/stoneos.rb b/lib/oxidized/model/stoneos.rb index 405e389..d2bc017 100644 --- a/lib/oxidized/model/stoneos.rb +++ b/lib/oxidized/model/stoneos.rb @@ -1,25 +1,19 @@ -class Stoneos < Oxidized::Model -#Hillstone Networks StoneOS software +class StoneOS < Oxidized::Model + # Hillstone Networks StoneOS software prompt /^\r?[\w.()-]+[#>](\s)?$/ comment '# ' - + expect /^\s.*--More--.*$/ do |data, re| - send ' ' - data.sub re, '' - end - - cmd :all do |cfg| - cfg = cfg.lines.to_a[1..-2].join + send ' ' + data.sub re, '' end - cmd :secret do |cfg| - cfg + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join end - cmd 'show configuration running' do |cfg| - cfg - end + cmd 'show configuration running' cmd 'show version' do |cfg| comment cfg -- cgit v1.2.1