summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/sros.rb
diff options
context:
space:
mode:
authorKodApa85 <parsons151185@gmail.com>2018-04-13 20:30:43 +0100
committerGitHub <noreply@github.com>2018-04-13 20:30:43 +0100
commitdbbe6af563072b62e373a9824c6a23482d20896e (patch)
treeab5341e8b1cd37aa0abf54662714f272cd8f9633 /lib/oxidized/model/sros.rb
parent97aa0535a0c8c237c1ccb7a1683d5f6faa1f0339 (diff)
parent56ec279b2e9e2735ed88405fd177e77f9e376801 (diff)
Merge branch 'master' into xgs4600-cli
Diffstat (limited to 'lib/oxidized/model/sros.rb')
-rw-r--r--lib/oxidized/model/sros.rb118
1 files changed, 118 insertions, 0 deletions
diff --git a/lib/oxidized/model/sros.rb b/lib/oxidized/model/sros.rb
new file mode 100644
index 0000000..289bed3
--- /dev/null
+++ b/lib/oxidized/model/sros.rb
@@ -0,0 +1,118 @@
+class SROS < Oxidized::Model
+
+ #
+ # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
+ # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
+ #
+
+ comment '# '
+
+ prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
+
+ cmd :all do |cfg, cmdstring|
+ new_cfg = comment "COMMAND: #{cmdstring}\n"
+ new_cfg << cfg.each_line.to_a[1..-2].join
+ end
+
+ #
+ # Show the boot options file.
+ #
+ cmd 'show bof' do |cfg|
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the system information.
+ #
+ cmd 'show system information' do |cfg|
+ #
+ # Strip uptime.
+ #
+ cfg.sub! /^System Up Time.*\n/, ''
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the card state.
+ #
+ cmd 'show card state' do |cfg|
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the boot log.
+ #
+ cmd 'file type bootlog.txt' do |cfg|
+ #
+ # Strip carriage returns and backspaces.
+ #
+ cfg.gsub! /\r/, ''
+ cfg.gsub! /[\b][\b][\b]/, "\n"
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the running debug configuration.
+ #
+ cmd 'show debug' do |cfg|
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the saved debug configuration (admin debug-save).
+ #
+ cmd 'file type config.dbg' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the running persistent indices.
+ #
+ cmd 'admin display-config index' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ comment cfg
+ end
+
+ #
+ # Show the running configuration.
+ #
+ cmd 'admin display-config' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ cfg.gsub! /# Finished .*/, ''
+ cfg.gsub! /# Generated .*/, ''
+ end
+
+ cfg :telnet do
+ username /^Login: /
+ password /^Password: /
+ end
+
+ cfg :telnet, :ssh do
+ post_login 'environment no more'
+ pre_logout 'logout'
+ end
+end