Sha256: f648217183f37a3af9b2aa18f4f3de438863951a6e1ff567262f72143b17e184
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
class JunOS < Oxidized::Model using Refinements comment '# ' def telnet @input.class.to_s.match(/Telnet/) end cmd :all do |cfg| cfg = cfg.cut_both if screenscrape cfg.gsub!(/ scale-subscriber (\s+)(\d+)/, ' scale-subscriber <count>') cfg.gsub!(/VMX-BANDWIDTH\s+(\d+) (.*)/, 'VMX-BANDWIDTH <count> \2') cfg.lines.map { |line| line.rstrip }.join("\n") + "\n" end cmd :secret do |cfg| cfg.gsub!(/community (\S+) {/, 'community <hidden> {') cfg.gsub!(/(ssh-(rsa|dsa|ecdsa|ecdsa-sk|ed25519|ed25519-sk) )".*; ## SECRET-DATA/, '<secret removed>') cfg.gsub!(/ "\$\d\$\S+; ## SECRET-DATA/, ' <secret removed>;') cfg end cmd 'show version' do |cfg| @model = Regexp.last_match(1) if cfg =~ /^Model: (\S+)/ comment cfg end post do out = '' case @model when 'mx960' out << cmd('show chassis fabric reachability') { |cfg| comment cfg } when /^(ex22|ex3[34]|ex4|ex8|qfx)/ out << cmd('show virtual-chassis') { |cfg| comment cfg } end out end cmd('show chassis hardware') { |cfg| comment cfg } cmd('show system license') do |cfg| cfg.gsub!(/ fib-scale\s+(\d+)/, ' fib-scale <count>') cfg.gsub!(/ rib-scale\s+(\d+)/, ' rib-scale <count>') comment cfg end cmd('show system license keys') { |cfg| comment cfg } cmd 'show configuration | display omit' cfg :telnet do username(/^login:/) password(/^Password:/) end cfg :ssh do exec true # don't run shell, run each command in exec channel end cfg :telnet, :ssh do post_login 'set cli screen-length 0' post_login 'set cli screen-width 0' pre_logout 'exit' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oxidized-0.30.1 | lib/oxidized/model/junos.rb |
oxidized-0.30.0 | lib/oxidized/model/junos.rb |