diff options
Diffstat (limited to 'lib/oxidized/model/ipos.rb')
-rw-r--r-- | lib/oxidized/model/ipos.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/oxidized/model/ipos.rb b/lib/oxidized/model/ipos.rb new file mode 100644 index 0000000..5efd831 --- /dev/null +++ b/lib/oxidized/model/ipos.rb @@ -0,0 +1,61 @@ +class IPOS < Oxidized::Model + + # Ericsson SSR (IPOS) + # Redback SE (SEOS) + + prompt /^([\[\]\w.@-]+[#>]\s?)$/ + comment '! ' + + cmd 'show chassis' do |cfg| + comment cfg.each_line.to_a[0..-2].join + end + + cmd 'show hardware' do |cfg| + comment cfg.each_line.to_a[0..-2].join + end + + cmd 'show release' do |cfg| + comment cfg.each_line.to_a[0..-2].join + end + + cmd 'show configuration' do |cfg| + # SEOS regularly adds some odd line breaks in random places + # when showing the config, triggering changes. + cfg.gsub! "\r\n", "\n" + + cfg = cfg.each_line.to_a + + # Keeps the issued command commented but removes the uncommented "Building configuration..." + # and "Current configuration:" lines as well as the last prompt at the end. + cfg = cfg[4..-2].unshift comment cfg[0] + + # Later IPOS releases add this line in addition to the usual "last changed" line. + # It's touched regularly (as often as multiple times per minute) by the OS without actual visible config changes. + cfg = cfg.reject { |line| line.match "Configuration last changed by system user" } + + # Earlier IPOS releases lack the "changed by system user" line and instead overwrite + # the single "last changed by user" line. Because the line has a timestamp it will + # trigger constant changes if not removed. By doing so there will only be a single + # extra change trigged after an actual config change by a user but still have the + # real user. + cfg = cfg.reject { |line| line.match "Configuration last changed by user '%LICM%' at" } + cfg = cfg.reject { |line| line.match "Configuration last changed by user '<NO USER>' at" } + cfg = cfg.reject { |line| line.match "Configuration last changed by user '' at" } + + cfg.join + end + + cfg :telnet do + username /^login:/ + password /^\r*password:/ + end + + cfg :telnet, :ssh do + post_login 'terminal length 0' + pre_logout do + send "exit\n" + send "n\n" + end + end + +end |