Class: Seeker::Junos

Inherits:
Object
  • Object
show all
Defined in:
lib/seeker/junos.rb

Constant Summary collapse

KNOWN =
%w( apply-flags apply-lock apply-macro inherit )
CHARS =
('a'..'z').to_a + ('0'..'9').to_a + %w( - )
REPORT_INTERVAL =
10*60
INVALID_INTERFACES =
[
  /^error: invalid interface type/,
  /^error: missing or invalid (?:device|fpc) number/,
]

Instance Method Summary collapse

Instance Method Details

#seekObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/seeker/junos.rb', line 14

def seek
  @ssh = ssh_connect
  @ssh.cmd 'configure'
  start = Time.now
  @report = start+REPORT_INTERVAL
  Log.info "starting"
  seek_level @opts[:level]
  Log.info "finishing, took #{(Time.now - start)/60} minutes"
  @ssh.cmd 'rollback'
  @ssh.cmd 'exit'
  @ssh.close
  @found
end

#seek_level(level) ⇒ Object



28
29
30
31
32
33
# File 'lib/seeker/junos.rb', line 28

def seek_level level
  @ssh.cmd 'edit ' + level if level
  @known = known_get
  find_hidden
  @ssh.cmd 'top'
end