summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/ciscosma.rb
blob: a52e38a7aff14436d89e9c035b16df41f013c9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class CiscoSMA < Oxidized::Model

	# SMA 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