Sha256: 295a0d270900da0aedf034071f048c3f2edf813d9a6d261192cf803bc28f6638
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# Oxidized model for ADVA devices # # IMPORTANT: To get this working, cli-paging must be disabled # for the user that is used to fetch the configuration. class ADVA < Oxidized::Model prompt /\w+\-+[#>]\s?$/ comment '# ' cmd :secret do |cfg| cfg.gsub! /community "[^"]+"/, 'community "<hidden>"' cfg end cmd :all do |cfg| cfg.cut_both end cmd 'show running-config current' do |cfg| cfg.each_line.reject { |line| line.match /^Preparing configuration file.*/ }.join end cmd 'show system' do |cfg| cfg = cfg.each_line.reject { |line| line.match /(up time|local time)/i }.join cfg = "COMMAND: show system\n\n" + cfg cfg = comment cfg "\n\n" + cfg end cmd 'network-element ne-1' cmd 'show shelf-info' do |cfg| cfg = "COMMAND: show shelf-info\n\n" + cfg cfg = comment cfg "\n\n" + cfg end post do ports = [] ports_output = '' cmd 'show ports' do |cfg| cfg.each_line do |line| port = line.match(/\|((access|network)[^\|]+)\|/) ports << port if port end end ports.each do |port| port_command = 'show ' + port[2] + '-port ' + port[1] ports_output << cmd(port_command) do |cfg| cfg = "COMMAND: " + port_command + "\n\n" + cfg cfg = comment cfg "\n\n" + cfg end end ports_output end cfg :ssh do pre_logout 'logout' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.29.0 | lib/oxidized/model/adva.rb |