summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/sma.rb
diff options
context:
space:
mode:
authorcd67-usrt <service.git@bas-rhin.fr>2017-06-19 13:26:44 +0200
committerGitHub <noreply@github.com>2017-06-19 13:26:44 +0200
commitfc12b03e86a68000077f0c126ebeb8af4763eaf5 (patch)
tree2ed8805748a284e3844e412f473d92589a812396 /lib/oxidized/model/sma.rb
parentdc425ce5bc3143cf4b8322602d7b7521aca37134 (diff)
Create sma.rb
Diffstat (limited to 'lib/oxidized/model/sma.rb')
-rw-r--r--lib/oxidized/model/sma.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/oxidized/model/sma.rb b/lib/oxidized/model/sma.rb
new file mode 100644
index 0000000..b551ee3
--- /dev/null
+++ b/lib/oxidized/model/sma.rb
@@ -0,0 +1,45 @@
+class SMA < Oxidized::Model
+
+ # ESA prompt "mail.example.com> "
+ prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/
+ comment '! '
+
+ # Select passphrase display option
+ expect /using loadconfig command\. \[Y\]\>/ do |data, re|
+ send "y\n"
+ data.sub re, ''
+ end
+
+ # handle paging
+ expect /-Press Any Key For More-+.*$/ do |data, re|
+ send " "
+ data.sub re, ''
+ end
+
+ cmd 'version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'showconfig' do |cfg|
+ #Delete hour and date which change each run
+ #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
+ # Delete select passphrase display option
+ cfg.gsub! /Do you want to mask the password\? Files with masked passwords cannot be loaded/, ''
+ cfg.gsub! /^\s+y/, ''
+ # Delete space
+ cfg.gsub! /\n\s{25}/, ''
+ # Delete after line
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{27})/,"\\1"
+ # Add a carriage return
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{6,8})([\/\-,.\w><@]+)/,"\\1\n\\2\\3"
+ # Delete prompt
+ cfg.gsub! /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/, ''
+ cfg
+
+ end
+
+ cfg :ssh do
+ pre_logout "exit"
+ end
+
+end