summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWild Kat <wk@futureinquestion.net>2018-03-17 17:49:18 +0100
committerWild Kat <wk@futureinquestion.net>2018-03-17 17:49:18 +0100
commitd3c96a04c15ff0c6cae00d0721a6f5216357207f (patch)
tree362a7f903a80644d71e395c9654d5f31d3659fc2
parenta9af29b42879d4cac8df88c96891b44b98719b90 (diff)
transition timos to sros
-rw-r--r--docs/Supported-OS-Types.md4
-rw-r--r--lib/oxidized/model/sros.rb118
-rw-r--r--lib/oxidized/model/supermicro.rb1
-rw-r--r--lib/oxidized/model/timos.rb120
4 files changed, 127 insertions, 116 deletions
diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md
index 1717284..493918d 100644
--- a/docs/Supported-OS-Types.md
+++ b/docs/Supported-OS-Types.md
@@ -10,7 +10,7 @@
* [AOS](/lib/oxidized/model/aos.rb)
* [AOS7](/lib/oxidized/model/aos7.rb)
* [ISAM](/lib/oxidized/model/isam.rb)
- * [SR OS (Formerly TiMOS)](/lib/oxidized/model/timos.rb)
+ * [SR OS (Formerly TiMOS)](/lib/oxidized/model/sros.rb)
* Wireless
* Allied Telesis
* [Alliedware Plus](/lib/oxidized/model/awplus.rb)
@@ -122,7 +122,7 @@
* Netonix
* [WISP Switch (As Netonix)](/lib/oxidized/model/netonix.rb)
* Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)
- * [SR OS (TiMOS)](/lib/oxidized/model/timos.rb)
+ * [SR OS (TiMOS)](/lib/oxidized/model/sros.rb)
* OneAccess
* [OneOS](/lib/oxidized/model/oneos.rb)
* Opengear
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
diff --git a/lib/oxidized/model/supermicro.rb b/lib/oxidized/model/supermicro.rb
index 518ae41..56d5ef6 100644
--- a/lib/oxidized/model/supermicro.rb
+++ b/lib/oxidized/model/supermicro.rb
@@ -7,3 +7,4 @@ Supermicro = EdgeCOS
Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead."
+# Deprecated
diff --git a/lib/oxidized/model/timos.rb b/lib/oxidized/model/timos.rb
index c230a8f..e454630 100644
--- a/lib/oxidized/model/timos.rb
+++ b/lib/oxidized/model/timos.rb
@@ -1,118 +1,10 @@
-class TiMOS < Oxidized::Model
+# Backward compatibility shim for deprecated model `timos`.
+# Migrate your source from `timos` to `sros`.
- #
- # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
- # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
- #
+require_relative 'sros.rb'
- comment '# '
+TiMOS = SROS
- prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
+Oxidized.logger.warn "Using deprecated model timos, use sros instead."
- 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
+# Deprecated