oxidized 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +4 -0
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +26 -2
  5. data/Dockerfile +8 -32
  6. data/README.md +17 -5
  7. data/bin/oxidized +1 -1
  8. data/docs/Configuration.md +41 -3
  9. data/docs/Hooks.md +26 -0
  10. data/docs/Model-Notes/AireOS.md +1 -2
  11. data/docs/Model-Notes/ArbOS.md +1 -2
  12. data/docs/Model-Notes/Comware.md +1 -2
  13. data/docs/Model-Notes/EOS.md +1 -2
  14. data/docs/Model-Notes/JunOS.md +1 -2
  15. data/docs/Model-Notes/Netgear.md +5 -6
  16. data/docs/Model-Notes/Nokia.md +9 -0
  17. data/docs/Model-Notes/README.md +3 -2
  18. data/docs/Model-Notes/VRP-Huawei.md +1 -2
  19. data/docs/Model-Notes/Viptela.md +12 -0
  20. data/docs/Model-Notes/XGS4600-Zyxel.md +1 -2
  21. data/docs/Ruby-API.md +54 -2
  22. data/docs/Supported-OS-Types.md +12 -0
  23. data/extra/oxidized.service +7 -0
  24. data/lib/oxidized/cli.rb +7 -0
  25. data/lib/oxidized/config.rb +3 -0
  26. data/lib/oxidized/core.rb +1 -0
  27. data/lib/oxidized/hook/ciscosparkdiff.rb +11 -17
  28. data/lib/oxidized/hook/slackdiff.rb +5 -11
  29. data/lib/oxidized/hook/xmppdiff.rb +1 -0
  30. data/lib/oxidized/input/ssh.rb +43 -27
  31. data/lib/oxidized/input/telnet.rb +1 -0
  32. data/lib/oxidized/model/acos.rb +2 -2
  33. data/lib/oxidized/model/acsw.rb +6 -6
  34. data/lib/oxidized/model/adtran.rb +22 -0
  35. data/lib/oxidized/model/aen.rb +2 -2
  36. data/lib/oxidized/model/aireos.rb +3 -2
  37. data/lib/oxidized/model/alteonos.rb +2 -2
  38. data/lib/oxidized/model/aos.rb +1 -1
  39. data/lib/oxidized/model/aos7.rb +1 -1
  40. data/lib/oxidized/model/aosw.rb +5 -3
  41. data/lib/oxidized/model/apc_aos.rb +1 -1
  42. data/lib/oxidized/model/arbos.rb +2 -2
  43. data/lib/oxidized/model/asa.rb +8 -2
  44. data/lib/oxidized/model/awplus.rb +1 -1
  45. data/lib/oxidized/model/axos.rb +16 -0
  46. data/lib/oxidized/model/c4cmts.rb +3 -5
  47. data/lib/oxidized/model/casa.rb +1 -1
  48. data/lib/oxidized/model/catos.rb +1 -1
  49. data/lib/oxidized/model/ciscosma.rb +1 -1
  50. data/lib/oxidized/model/ciscosmb.rb +10 -4
  51. data/lib/oxidized/model/comtrol.rb +41 -0
  52. data/lib/oxidized/model/comware.rb +1 -1
  53. data/lib/oxidized/model/coriantgroove.rb +4 -6
  54. data/lib/oxidized/model/cumulus.rb +14 -1
  55. data/lib/oxidized/model/datacom.rb +1 -2
  56. data/lib/oxidized/model/dcnos.rb +1 -1
  57. data/lib/oxidized/model/dellx.rb +76 -0
  58. data/lib/oxidized/model/dlink.rb +2 -2
  59. data/lib/oxidized/model/dnos.rb +3 -1
  60. data/lib/oxidized/model/eciapollo.rb +34 -0
  61. data/lib/oxidized/model/edgecos.rb +1 -0
  62. data/lib/oxidized/model/edgeos.rb +6 -1
  63. data/lib/oxidized/model/eos.rb +3 -2
  64. data/lib/oxidized/model/fiberdriver.rb +1 -1
  65. data/lib/oxidized/model/firebrick.rb +31 -0
  66. data/lib/oxidized/model/firewareos.rb +1 -1
  67. data/lib/oxidized/model/fortios.rb +5 -4
  68. data/lib/oxidized/model/ftos.rb +4 -1
  69. data/lib/oxidized/model/fujitsupy.rb +3 -3
  70. data/lib/oxidized/model/gaiaos.rb +1 -1
  71. data/lib/oxidized/model/gcombnps.rb +3 -1
  72. data/lib/oxidized/model/hatteras.rb +1 -1
  73. data/lib/oxidized/model/hirschmann.rb +2 -2
  74. data/lib/oxidized/model/hpebladesystem.rb +1 -1
  75. data/lib/oxidized/model/ios.rb +21 -13
  76. data/lib/oxidized/model/ipos.rb +3 -3
  77. data/lib/oxidized/model/ironware.rb +3 -3
  78. data/lib/oxidized/model/isam.rb +1 -1
  79. data/lib/oxidized/model/junos.rb +1 -1
  80. data/lib/oxidized/model/masteros.rb +2 -3
  81. data/lib/oxidized/model/mlnxos.rb +5 -5
  82. data/lib/oxidized/model/model.rb +3 -0
  83. data/lib/oxidized/model/ndms.rb +1 -2
  84. data/lib/oxidized/model/netgear.rb +7 -9
  85. data/lib/oxidized/model/netonix.rb +1 -1
  86. data/lib/oxidized/model/netscaler.rb +6 -1
  87. data/lib/oxidized/model/nos.rb +2 -2
  88. data/lib/oxidized/model/oneos.rb +1 -1
  89. data/lib/oxidized/model/openbsd.rb +8 -22
  90. data/lib/oxidized/model/openwrt.rb +1 -0
  91. data/lib/oxidized/model/opnsense.rb +1 -1
  92. data/lib/oxidized/model/panos.rb +9 -9
  93. data/lib/oxidized/model/pfsense.rb +2 -1
  94. data/lib/oxidized/model/planet.rb +1 -1
  95. data/lib/oxidized/model/powerconnect.rb +7 -4
  96. data/lib/oxidized/model/procurve.rb +7 -5
  97. data/lib/oxidized/model/routeros.rb +1 -1
  98. data/lib/oxidized/model/saos.rb +1 -1
  99. data/lib/oxidized/model/screenos.rb +3 -3
  100. data/lib/oxidized/model/sros.rb +2 -2
  101. data/lib/oxidized/model/stoneos.rb +1 -1
  102. data/lib/oxidized/model/tmos.rb +2 -0
  103. data/lib/oxidized/model/tplink.rb +4 -0
  104. data/lib/oxidized/model/viptela.rb +29 -0
  105. data/lib/oxidized/model/voltaire.rb +5 -5
  106. data/lib/oxidized/model/voss.rb +4 -4
  107. data/lib/oxidized/model/vrp.rb +1 -1
  108. data/lib/oxidized/model/vyatta.rb +1 -1
  109. data/lib/oxidized/model/weos.rb +1 -1
  110. data/lib/oxidized/model/xos.rb +9 -2
  111. data/lib/oxidized/node.rb +20 -31
  112. data/lib/oxidized/nodes.rb +3 -0
  113. data/lib/oxidized/output/git.rb +17 -20
  114. data/lib/oxidized/output/gitcrypt.rb +2 -1
  115. data/lib/oxidized/output/http.rb +19 -12
  116. data/lib/oxidized/source/csv.rb +15 -8
  117. data/lib/oxidized/source/http.rb +26 -22
  118. data/lib/oxidized/string.rb +9 -4
  119. data/lib/oxidized/version.rb +2 -2
  120. data/lib/oxidized/worker.rb +44 -36
  121. data/oxidized.gemspec +1 -4
  122. metadata +26 -16
@@ -1,7 +1,7 @@
1
1
  class Dlink < Oxidized::Model
2
2
  # D-LINK Switches
3
3
 
4
- prompt /^(\r*[\w.@():-]+[#>]\s?)$/
4
+ prompt /^(\r*[\w.@()\/:-]+[#>]\s?)$/
5
5
  comment '# '
6
6
 
7
7
  cmd :secret do |cfg|
@@ -15,7 +15,7 @@ class Dlink < Oxidized::Model
15
15
  end
16
16
 
17
17
  cmd 'show switch' do |cfg|
18
- cfg.gsub! /^System\ Uptime\s.+/, '' # Omit constantly changing uptime info
18
+ cfg.gsub! /^System Uptime\s.+/, '' # Omit constantly changing uptime info
19
19
  comment cfg
20
20
  end
21
21
 
@@ -5,13 +5,15 @@ class DNOS < Oxidized::Model
5
5
 
6
6
  cmd :all do |cfg|
7
7
  cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
8
- cfg.gsub! /^Dell Networking OS uptime is\s.+/, '' # Omit constantly changing uptime info
8
+ cfg.gsub! /(uptime is)(\s.+)/, '\\1 <removed>' # Omit changing uptime info
9
9
  cfg.each_line.to_a[2..-2].join
10
10
  end
11
11
 
12
12
  cmd :secret do |cfg|
13
13
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
14
14
  cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
15
+ cfg.gsub! /password (\d+) (\S+).*/, '<secret hidden>'
16
+ cfg.gsub! /^(tacacs-server key \d+) (\S+).*/, '\\1 <secret hidden>'
15
17
  cfg
16
18
  end
17
19
 
@@ -0,0 +1,34 @@
1
+ # ECI Telecom Apollo
2
+ # Tested on OPT9608 systems via SSH and telnet
3
+
4
+ class ECIapollo < Oxidized::Model
5
+ prompt /^([\w.@()-]+[#>]\s?)$/
6
+ comment '# '
7
+
8
+ cmd :all do |cfg|
9
+ cfg.each_line.to_a[1..-2].join
10
+ end
11
+
12
+ cmd :secret do |cfg|
13
+ cfg.gsub!(/community (\S+) {/, 'community <hidden> {')
14
+ cfg.gsub!(/ "\$\d\$\S+; ## SECRET-DATA/, ' <secret removed>;')
15
+ cfg
16
+ end
17
+
18
+ cfg :telnet do
19
+ username(/^login:/)
20
+ password(/^Password:/)
21
+ end
22
+
23
+ cfg :telnet, :ssh do
24
+ post_login 'set cli screen-length 0'
25
+ post_login 'set cli screen-width 0'
26
+ pre_logout 'exit'
27
+ end
28
+
29
+ cmd('show version') { |cfg| comment cfg }
30
+ cmd('show system licenses') { |cfg| comment cfg }
31
+ cmd('show configuration') { |cfg| comment cfg }
32
+ cmd('show configuration | display-set') { |cfg| cfg }
33
+ cmd('show chassis inventory') { |cfg| comment cfg }
34
+ end
@@ -15,6 +15,7 @@ class EdgeCOS < Oxidized::Model
15
15
 
16
16
  cmd 'show system' do |cfg|
17
17
  cfg.gsub! /^\s*System Up Time\s*:.*\n/i, ''
18
+ cfg.gsub! /^\s*(Temperature \d*:).*\n/i, '\\1 <removed>'
18
19
  comment cfg
19
20
  end
20
21
 
@@ -1,7 +1,7 @@
1
1
  class Edgeos < Oxidized::Model
2
2
  # EdgeOS #
3
3
 
4
- prompt /\@.*?\:~\$\s/
4
+ prompt /@.*?:~\$\s/
5
5
 
6
6
  cmd :all do |cfg|
7
7
  cfg = cfg.lines.to_a[1..-2].join
@@ -16,6 +16,11 @@ class Edgeos < Oxidized::Model
16
16
  cfg
17
17
  end
18
18
 
19
+ cmd 'show version | no-more' do |cfg|
20
+ cfg.gsub! /^Uptime:\s.+/, ''
21
+ comment cfg
22
+ end
23
+
19
24
  cmd 'show configuration commands | no-more'
20
25
 
21
26
  cfg :telnet do
@@ -6,12 +6,13 @@ class EOS < Oxidized::Model
6
6
  comment '! '
7
7
 
8
8
  cmd :all do |cfg|
9
- cfg.each_line.to_a[1..-2].join
9
+ cfg.cut_both
10
10
  end
11
11
 
12
12
  cmd :secret do |cfg|
13
13
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
14
- cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
14
+ cfg.gsub! /(secret \w+) (\S+).*/, '\\1 <secret hidden>'
15
+ cfg.gsub! /(password \d+) (\S+).*/, '\\1 <secret hidden>'
15
16
  cfg.gsub! /^(enable secret).*/, '\\1 <configuration removed>'
16
17
  cfg.gsub! /^(tacacs-server key \d+).*/, '\\1 <configuration removed>'
17
18
  cfg
@@ -3,7 +3,7 @@ class FiberDriver < Oxidized::Model
3
3
  comment "! "
4
4
 
5
5
  cmd :all do |cfg|
6
- cfg.each_line.to_a[1..-2].join
6
+ cfg.cut_both
7
7
  end
8
8
  cmd 'show inventory' do |cfg|
9
9
  comment cfg
@@ -0,0 +1,31 @@
1
+ class Firebrick < Oxidized::Model
2
+ # Firebrick #
3
+ prompt /\x0a\x1b\x5b\x32\x4b\x0d.*>\s/
4
+
5
+ cmd :all do |cfg|
6
+ # remove arbitrary whitespace after commands.
7
+ cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join
8
+ end
9
+
10
+ cmd 'show status' do |cfg|
11
+ cfg.gsub! /Status/, ''
12
+ cfg.gsub! /------/, ''
13
+ cfg.gsub! /Uptime.*/, ''
14
+ cfg.gsub! /Current time.*/, ''
15
+ cfg.gsub! /RAM.*/, ''
16
+ cfg.gsub! /Warranty.*/, ''
17
+
18
+ comment cfg
19
+ end
20
+
21
+ cmd 'show configuration'
22
+
23
+ cfg :telnet do
24
+ username /Username:\s?/
25
+ password /Password:\s?/
26
+ end
27
+
28
+ cfg :telnet, :ssh do
29
+ pre_logout 'exit'
30
+ end
31
+ end
@@ -3,7 +3,7 @@ class FirewareOS < Oxidized::Model
3
3
  comment '-- '
4
4
 
5
5
  cmd :all do |cfg|
6
- cfg.each_line.to_a[1..-2].join
6
+ cfg.cut_both
7
7
  end
8
8
 
9
9
  # Handle Logon Disclaimer added in XTM 11.9.3
@@ -1,7 +1,7 @@
1
1
  class FortiOS < Oxidized::Model
2
2
  comment '# '
3
3
 
4
- prompt /^([-\w\.\~]+(\s[\(\w\-\.\)]+)?\~?\s?[#>$]\s?)$/
4
+ prompt /^([-\w.~]+(\s[(\w\-.)]+)?~?\s?[#>$]\s?)$/
5
5
 
6
6
  expect /^--More--\s$/ do |data, re|
7
7
  send ' '
@@ -19,9 +19,10 @@ class FortiOS < Oxidized::Model
19
19
  cfg.gsub! /(set .*secret) .+/, '\\1 <configuration removed>'
20
20
  # A number of other statements also contains sensitive strings
21
21
  cfg.gsub! /(set (?:passwd|password|key|group-password|auth-password-l1|auth-password-l2|rsso|history0|history1)) .+/, '\\1 <configuration removed>'
22
- cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m, '\\1 <configuration removed>'
23
- cfg.gsub! /(set ca ).*-+END CERTIFICATE-*"$/m, '\\1 <configuration removed>'
24
- cfg.gsub! /(set csr ).*-+END CERTIFICATE REQUEST-*"$/m, '\\1 <configuration removed>'
22
+ cfg.gsub! /(set md5-key [0-9]+) .+/, '\\1 <configuration removed>'
23
+ cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA) PRIVATE KEY-*"$/m, '\\1<configuration removed>'
24
+ cfg.gsub! /(set ca ).*?-+END CERTIFICATE-*"$/m, '\\1<configuration removed>'
25
+ cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-*"$/m, '\\1<configuration removed>'
25
26
  cfg.gsub! /(Cluster uptime:).*/, '\\1 <stripped>'
26
27
  cfg
27
28
  end
@@ -9,7 +9,10 @@ class FTOS < Oxidized::Model
9
9
 
10
10
  cmd :secret do |cfg|
11
11
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
12
- cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
12
+ cfg.gsub! /(secret \d* {0,1})\S+(.*)/, '\\1<secret hidden>\\2'
13
+ cfg.gsub! /(password \d+) \S+(.*)/, '\\1 <hash hidden>\\2'
14
+ cfg.gsub! /(^snmp-server.*version \S+) \S+(.*)/, '\\1 <community removed>\\2'
15
+ cfg.gsub! /(^radius-server.*key \d )\S+/, '\\1<hash hidden>\\2'
13
16
  cfg
14
17
  end
15
18
 
@@ -1,9 +1,9 @@
1
1
  class FujitsuPY < Oxidized::Model
2
- prompt /^(\([\w.-]*\)\s#|^\S+\#\s)$/
2
+ prompt /^(\([\w.-]*\)\s#|^\S+#\s)$/
3
3
  comment '! '
4
4
 
5
5
  cmd :all do |cfg|
6
- cfg.each_line.to_a[1..-2].join
6
+ cfg.cut_both
7
7
  end
8
8
 
9
9
  # 1Gbe switch
@@ -16,7 +16,7 @@ class FujitsuPY < Oxidized::Model
16
16
  cmd 'show system information' do |cfg|
17
17
  cfg.gsub! /^Current-time : [\w\s:]*$/, ''
18
18
  cfg.gsub! /^(\s{33}\^)$/, ''
19
- cfg.gsub! /^(\% Invalid input detected at '\^' marker.)$/, ''
19
+ cfg.gsub! /^(% Invalid input detected at '\^' marker.)$/, ''
20
20
  comment cfg
21
21
  end
22
22
 
@@ -8,7 +8,7 @@ class GaiaOS < Oxidized::Model
8
8
  comment '# '
9
9
 
10
10
  cmd :all do |cfg|
11
- cfg = cfg.each_line.to_a[1..-2].join
11
+ cfg.cut_both
12
12
  end
13
13
 
14
14
  cmd :secret do |cfg|
@@ -22,7 +22,7 @@ class GcomBNPS < Oxidized::Model
22
22
 
23
23
  cmd :all do |cfg|
24
24
  cfg = cfg.gsub " \e[73D\e[K", '' # remove garbage remaining from the pager
25
- cfg.each_line.to_a[1..-2].join
25
+ cfg.cut_both
26
26
  end
27
27
 
28
28
  cmd :secret do |cfg|
@@ -42,6 +42,7 @@ class GcomBNPS < Oxidized::Model
42
42
  next if line.match /^ Bias Current\(mA\)/
43
43
  next if line.match /^ RX Power\(dBM\)/
44
44
  next if line.match /^ TX Power\(dBM\)/
45
+
45
46
  out << line
46
47
  end
47
48
 
@@ -57,6 +58,7 @@ class GcomBNPS < Oxidized::Model
57
58
  cfg.each_line do |line|
58
59
  next if line.match /^system run time :/
59
60
  next if line.match /^switch temperature :/
61
+
60
62
  out << line
61
63
  end
62
64
 
@@ -17,7 +17,7 @@ class Hatteras < Oxidized::Model
17
17
  end
18
18
 
19
19
  cmd :all do |cfg|
20
- cfg.each_line.to_a[1..-2].join
20
+ cfg.cut_both
21
21
  end
22
22
 
23
23
  cmd "show switch\r" do |cfg|
@@ -1,5 +1,5 @@
1
1
  class Hirschmann < Oxidized::Model
2
- prompt /^[\(\w\s\w\)]+\s[>|#]+?$/
2
+ prompt /^[(\w\s)]+\s[>|#]+?$/
3
3
 
4
4
  comment '## '
5
5
 
@@ -10,7 +10,7 @@ class Hirschmann < Oxidized::Model
10
10
  end
11
11
 
12
12
  cmd :all do |cfg|
13
- cfg.each_line.to_a[1..-2].join
13
+ cfg.cut_both
14
14
  end
15
15
 
16
16
  cmd 'show sysinfo' do |cfg|
@@ -11,7 +11,7 @@ class HPEBladeSystem < Oxidized::Model
11
11
 
12
12
  cmd :all do |cfg|
13
13
  cfg = cfg.delete("\r").each_line.to_a[0..-1].map { |line| line.rstrip }.join("\n") + "\n"
14
- cfg.each_line.to_a[0..-2].join
14
+ cfg.cut_tail
15
15
  end
16
16
 
17
17
  cmd :secret do |cfg|
@@ -20,21 +20,27 @@ class IOS < Oxidized::Model
20
20
  # cfg.gsub! /\cH+/, '' # example how to handle pager
21
21
  # get rid of errors for commands that don't work on some devices
22
22
  cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
23
- cfg.each_line.to_a[1..-2].join
23
+ cfg.cut_both
24
24
  end
25
25
 
26
26
  cmd :secret do |cfg|
27
27
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
28
28
  cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( version (1|2c|3))?)\s+\S+((\s+\S*)*)\s*/, '\\1 <secret hidden> \\5'
29
- cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>'
30
- cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>'
31
- cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>'
32
- cfg.gsub! /^(enable (password|secret) \d) (\S+)/, '\\1 <secret hidden>'
29
+ cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
30
+ cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
33
31
  cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
34
32
  cfg.gsub! /^(.*wpa-psk ascii \d) (\S+)/, '\\1 <secret hidden>'
35
33
  cfg.gsub! /^(.*key 7) (\d.+)/, '\\1 <secret hidden>'
36
- cfg.gsub! /^(tacacs-server key \d) (\S+)/, '\\1 <secret hidden>'
34
+ cfg.gsub! /^(tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>'
37
35
  cfg.gsub! /^(crypto isakmp key) (\S+) (.*)/, '\\1 <secret hidden> \\3'
36
+ cfg.gsub! /^(\s+ip ospf message-digest-key \d+ md5) .+/, '\\1 <secret hidden>'
37
+ cfg.gsub! /^(\s+ip ospf authentication-key) .+/, '\\1 <secret hidden>'
38
+ cfg.gsub! /^(\s+neighbor \S+ password) .+/, '\\1 <secret hidden>'
39
+ cfg.gsub! /^(\s+vrrp \d+ authentication text) .+/, '\\1 <secret hidden>'
40
+ cfg.gsub! /^(\s+standby \d+ authentication) .{1,8}$/, '\\1 <secret hidden>'
41
+ cfg.gsub! /^(\s+standby \d+ authentication md5 key-string) .+?( timeout \d+)?$/, '\\1 <secret hidden> \\2'
42
+ cfg.gsub! /^(\s+key-string) .+/, '\\1 <secret hidden>'
43
+ cfg.gsub! /^((tacacs|radius) server [^\n]+\n(\s+[^\n]+\n)*\s+key) [^\n]+$/m, '\1 <secret hidden>'
38
44
  cfg
39
45
  end
40
46
 
@@ -97,7 +103,7 @@ class IOS < Oxidized::Model
97
103
  comments << "CPU:#{slave} #{cpu}#{cpuxtra}#{slaveslot}";
98
104
  end
99
105
 
100
- if line.match /^System image file is "([^\"]*)"$/
106
+ if line.match /^System image file is "([^"]*)"$/
101
107
  comments << "Image: #{$1}"
102
108
  end
103
109
  end
@@ -119,9 +125,9 @@ class IOS < Oxidized::Model
119
125
  cfg = cfg.each_line.to_a[3..-1]
120
126
  cfg = cfg.reject { |line| line.match /^ntp clock-period / }.join
121
127
  cfg.gsub! /^Current configuration : [^\n]*\n/, ''
122
- cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
123
- (?:\ [^\n]*\n*)*
124
- tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1'
128
+ cfg.gsub! /^ tunnel mpls traffic-eng bandwidth[^\n]*\n*(
129
+ (?: [^\n]*\n*)*
130
+ tunnel mpls traffic-eng auto-bw)/mx, '\1'
125
131
  cfg
126
132
  end
127
133
 
@@ -132,9 +138,11 @@ class IOS < Oxidized::Model
132
138
 
133
139
  cfg :telnet, :ssh do
134
140
  # preferred way to handle additional passwords
135
- if vars :enable
136
- post_login do
137
- send "enable\n"
141
+ post_login do
142
+ if vars(:enable) == true
143
+ cmd "enable"
144
+ elsif vars(:enable)
145
+ cmd "enable", /^[pP]assword:/
138
146
  cmd vars(:enable)
139
147
  end
140
148
  end
@@ -6,15 +6,15 @@ class IPOS < Oxidized::Model
6
6
  comment '! '
7
7
 
8
8
  cmd 'show chassis' do |cfg|
9
- comment cfg.each_line.to_a[0..-2].join
9
+ comment cfg.cut_tail
10
10
  end
11
11
 
12
12
  cmd 'show hardware' do |cfg|
13
- comment cfg.each_line.to_a[0..-2].join
13
+ comment cfg.cut_tail
14
14
  end
15
15
 
16
16
  cmd 'show release' do |cfg|
17
- comment cfg.each_line.to_a[0..-2].join
17
+ comment cfg.cut_tail
18
18
  end
19
19
 
20
20
  cmd 'show configuration' do |cfg|
@@ -1,5 +1,5 @@
1
1
  class IronWare < Oxidized::Model
2
- prompt /^.*(telnet|ssh)\@.+[>#]\s?$/i
2
+ prompt /^.*(telnet|ssh)@.+[>#]\s?$/i
3
3
  comment '! '
4
4
 
5
5
  # to handle pager without enable
@@ -30,8 +30,8 @@ class IronWare < Oxidized::Model
30
30
  cmd 'show chassis' do |cfg|
31
31
  cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) # sometimes ironware returns broken encoding
32
32
  cfg.gsub! /(^((.*)Current temp(.*))$)/, '' # remove unwanted lines current temperature
33
- cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}\%\)/, '' # remove unwanted lines Speed Fans
34
- cfg.gsub! /current speed is [A-Z]{2,6} \(\d{2,3}\%\)/, ''
33
+ cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}%\)/, '' # remove unwanted lines Speed Fans
34
+ cfg.gsub! /current speed is [A-Z]{2,6} \(\d{2,3}%\)/, ''
35
35
  cfg.gsub! /Fan \d* - STATUS: OK \D*\d*./, '' # Fix for ADX Fan speed reporting
36
36
  cfg.gsub! /\d* deg C/, '' # Fix for ADX temperature reporting
37
37
  cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
@@ -5,7 +5,7 @@ class ISAM < Oxidized::Model
5
5
  comment '# '
6
6
 
7
7
  cmd :all do |cfg|
8
- cfg.each_line.to_a[1..-2].join
8
+ cfg.cut_both
9
9
  end
10
10
 
11
11
  cfg :telnet do
@@ -6,7 +6,7 @@ class JunOS < Oxidized::Model
6
6
  end
7
7
 
8
8
  cmd :all do |cfg|
9
- cfg = cfg.lines.to_a[1..-2].join if screenscrape
9
+ cfg = cfg.cut_both if screenscrape
10
10
  cfg.gsub!(/ scale-subscriber (\s+)(\d+)/, ' scale-subscriber <count>')
11
11
  cfg.lines.map { |line| line.rstrip }.join("\n") + "\n"
12
12
  end
@@ -10,13 +10,12 @@ class MasterOS < Oxidized::Model
10
10
  end
11
11
 
12
12
  cmd :all do |cfg|
13
- cfg.each_line.to_a[1..-2].join
13
+ cfg.cut_both
14
14
  cfg.gsub /^(! Configuration ).*/, '!'
15
15
  end
16
16
 
17
17
  cmd 'show inventory' do |cfg|
18
- cfg = cfg.each_line.to_a[0..-2].join
19
- comment cfg
18
+ comment cfg.cut_tail
20
19
  end
21
20
 
22
21
  cmd 'show plugins' do |cfg|
@@ -3,7 +3,7 @@ class MLNXOS < Oxidized::Model
3
3
  comment '## '
4
4
 
5
5
  # Pager Handling
6
- expect /.+lines\s\d+\-\d+([\s]|\/\d+\s\(END\)\s).+$/ do |data, re|
6
+ expect /.+lines\s\d+-\d+([\s]|\/\d+\s\(END\)\s).+$/ do |data, re|
7
7
  send ' '
8
8
  data.sub re, ''
9
9
  end
@@ -12,10 +12,10 @@ class MLNXOS < Oxidized::Model
12
12
  cfg.gsub! /\[\?1h=\r/, '' # Pager Handling
13
13
  cfg.gsub! /\r\[K/, '' # Pager Handling
14
14
  cfg.gsub! /\s/, '' # Linebreak Handling
15
- cfg.gsub! /^CPU\ load\ averages\:\s.+/, '' # Omit constantly changing CPU info
16
- cfg.gsub! /^System\ memory\:\s.+/, '' # Omit constantly changing memory info
17
- cfg.gsub! /^Uptime\:\s.+/, '' # Omit constantly changing uptime info
18
- cfg.gsub! /.+Generated\ at\s\d+.+/, '' # Omit constantly changing generation time info
15
+ cfg.gsub! /^CPU load averages:\s.+/, '' # Omit constantly changing CPU info
16
+ cfg.gsub! /^System memory:\s.+/, '' # Omit constantly changing memory info
17
+ cfg.gsub! /^Uptime:\s.+/, '' # Omit constantly changing uptime info
18
+ cfg.gsub! /.+Generated at\s\d+.+/, '' # Omit constantly changing generation time info
19
19
  cfg = cfg.lines.to_a[2..-3].join
20
20
  end
21
21