oxidized 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +5 -5
  2. data/.github/no-response.yml +13 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +37 -0
  5. data/.rubocop_todo.yml +714 -0
  6. data/.travis.yml +7 -1
  7. data/CHANGELOG.md +341 -243
  8. data/Dockerfile +44 -16
  9. data/LICENSE +201 -0
  10. data/README.md +114 -82
  11. data/Rakefile +19 -0
  12. data/TODO.md +29 -23
  13. data/bin/oxidized +1 -2
  14. data/docs/Configuration.md +71 -31
  15. data/docs/Creating-Models.md +78 -0
  16. data/docs/Hooks.md +145 -41
  17. data/docs/Model-Notes/AireOS.md +12 -0
  18. data/docs/Model-Notes/ArbOS.md +12 -0
  19. data/docs/Model-Notes/Comware.md +14 -0
  20. data/docs/Model-Notes/EOS.md +9 -0
  21. data/docs/Model-Notes/JunOS.md +34 -0
  22. data/docs/Model-Notes/Netgear.md +68 -0
  23. data/docs/Model-Notes/README.md +19 -0
  24. data/docs/{VRP-Huawei.md → Model-Notes/VRP-Huawei.md} +10 -2
  25. data/docs/Model-Notes/XGS4600-Zyxel.md +39 -0
  26. data/docs/Outputs.md +27 -28
  27. data/docs/Ruby-API.md +38 -18
  28. data/docs/Sources.md +78 -16
  29. data/docs/Supported-OS-Types.md +171 -148
  30. data/extra/oxidized.logrotate +7 -0
  31. data/extra/oxidized.service +1 -1
  32. data/extra/rest_client.rb +4 -5
  33. data/extra/syslog.rb +16 -16
  34. data/lib/oxidized/cli.rb +3 -3
  35. data/lib/oxidized/config.rb +7 -4
  36. data/lib/oxidized/core.rb +3 -3
  37. data/lib/oxidized/hook.rb +64 -65
  38. data/lib/oxidized/hook/awssns.rb +2 -3
  39. data/lib/oxidized/hook/ciscosparkdiff.rb +49 -0
  40. data/lib/oxidized/hook/exec.rb +5 -5
  41. data/lib/oxidized/hook/githubrepo.rb +20 -14
  42. data/lib/oxidized/hook/slackdiff.rb +38 -19
  43. data/lib/oxidized/hook/xmppdiff.rb +58 -0
  44. data/lib/oxidized/input/cli.rb +5 -6
  45. data/lib/oxidized/input/ftp.rb +8 -7
  46. data/lib/oxidized/input/http.rb +39 -0
  47. data/lib/oxidized/input/ssh.rb +24 -22
  48. data/lib/oxidized/input/telnet.rb +38 -32
  49. data/lib/oxidized/jobs.rb +3 -4
  50. data/lib/oxidized/manager.rb +9 -4
  51. data/lib/oxidized/model/acos.rb +15 -16
  52. data/lib/oxidized/model/acsw.rb +3 -8
  53. data/lib/oxidized/model/aen.rb +1 -2
  54. data/lib/oxidized/model/aireos.rb +3 -5
  55. data/lib/oxidized/model/alteonos.rb +16 -18
  56. data/lib/oxidized/model/alvarion.rb +0 -4
  57. data/lib/oxidized/model/aos.rb +2 -4
  58. data/lib/oxidized/model/aos7.rb +2 -3
  59. data/lib/oxidized/model/aosw.rb +13 -15
  60. data/lib/oxidized/model/apc_aos.rb +0 -3
  61. data/lib/oxidized/model/arbos.rb +26 -0
  62. data/lib/oxidized/model/aricentiss.rb +51 -0
  63. data/lib/oxidized/model/asa.rb +33 -35
  64. data/lib/oxidized/model/asyncos.rb +41 -44
  65. data/lib/oxidized/model/audiocodes.rb +4 -8
  66. data/lib/oxidized/model/awplus.rb +84 -0
  67. data/lib/oxidized/model/boss.rb +6 -5
  68. data/lib/oxidized/model/br6910.rb +43 -45
  69. data/lib/oxidized/model/c4cmts.rb +3 -5
  70. data/lib/oxidized/model/cambium.rb +22 -0
  71. data/lib/oxidized/model/catos.rb +0 -2
  72. data/lib/oxidized/model/cisconga.rb +1 -3
  73. data/lib/oxidized/model/ciscosma.rb +37 -40
  74. data/lib/oxidized/model/ciscosmb.rb +7 -4
  75. data/lib/oxidized/model/comnetms.rb +43 -0
  76. data/lib/oxidized/model/comware.rb +9 -9
  77. data/lib/oxidized/model/coriant8600.rb +3 -5
  78. data/lib/oxidized/model/coriantgroove.rb +3 -5
  79. data/lib/oxidized/model/corianttmos.rb +1 -3
  80. data/lib/oxidized/model/cumulus.rb +26 -32
  81. data/lib/oxidized/model/datacom.rb +0 -2
  82. data/lib/oxidized/model/dcnos.rb +46 -0
  83. data/lib/oxidized/model/dlink.rb +1 -1
  84. data/lib/oxidized/model/dnos.rb +9 -5
  85. data/lib/oxidized/model/edgecos.rb +45 -0
  86. data/lib/oxidized/model/edgeos.rb +5 -3
  87. data/lib/oxidized/model/edgeswitch.rb +1 -3
  88. data/lib/oxidized/model/enterasys.rb +1 -3
  89. data/lib/oxidized/model/eos.rb +6 -8
  90. data/lib/oxidized/model/fabricos.rb +3 -5
  91. data/lib/oxidized/model/firewareos.rb +2 -5
  92. data/lib/oxidized/model/fortios.rb +21 -17
  93. data/lib/oxidized/model/ftos.rb +2 -4
  94. data/lib/oxidized/model/fujitsupy.rb +2 -4
  95. data/lib/oxidized/model/gaiaos.rb +6 -10
  96. data/lib/oxidized/model/gcombnps.rb +82 -0
  97. data/lib/oxidized/model/hatteras.rb +8 -5
  98. data/lib/oxidized/model/hirschmann.rb +8 -10
  99. data/lib/oxidized/model/hpebladesystem.rb +19 -17
  100. data/lib/oxidized/model/hpemsa.rb +0 -3
  101. data/lib/oxidized/model/ios.rb +54 -55
  102. data/lib/oxidized/model/iosxe.rb +5 -0
  103. data/lib/oxidized/model/iosxr.rb +1 -3
  104. data/lib/oxidized/model/ipos.rb +1 -3
  105. data/lib/oxidized/model/ironware.rb +12 -15
  106. data/lib/oxidized/model/isam.rb +4 -5
  107. data/lib/oxidized/model/junos.rb +8 -7
  108. data/lib/oxidized/model/masteros.rb +1 -3
  109. data/lib/oxidized/model/mlnxos.rb +3 -4
  110. data/lib/oxidized/model/model.rb +15 -7
  111. data/lib/oxidized/model/mtrlrfs.rb +1 -4
  112. data/lib/oxidized/model/ndms.rb +24 -0
  113. data/lib/oxidized/model/netgear.rb +3 -4
  114. data/lib/oxidized/model/netscaler.rb +0 -2
  115. data/lib/oxidized/model/nos.rb +1 -3
  116. data/lib/oxidized/model/nxos.rb +13 -3
  117. data/lib/oxidized/model/oneos.rb +6 -8
  118. data/lib/oxidized/model/openbsd.rb +76 -0
  119. data/lib/oxidized/model/opengear.rb +3 -5
  120. data/lib/oxidized/model/openwrt.rb +77 -0
  121. data/lib/oxidized/model/opnsense.rb +19 -0
  122. data/lib/oxidized/model/outputs.rb +1 -3
  123. data/lib/oxidized/model/panos.rb +1 -2
  124. data/lib/oxidized/model/pfsense.rb +9 -5
  125. data/lib/oxidized/model/planet.rb +8 -12
  126. data/lib/oxidized/model/powerconnect.rb +6 -9
  127. data/lib/oxidized/model/procurve.rb +18 -4
  128. data/lib/oxidized/model/quantaos.rb +3 -5
  129. data/lib/oxidized/model/routeros.rb +3 -2
  130. data/lib/oxidized/model/saos.rb +0 -1
  131. data/lib/oxidized/model/screenos.rb +3 -5
  132. data/lib/oxidized/model/sgos.rb +2 -3
  133. data/lib/oxidized/model/siklu.rb +0 -2
  134. data/lib/oxidized/model/slxos.rb +59 -0
  135. data/lib/oxidized/model/sros.rb +117 -0
  136. data/lib/oxidized/model/stoneos.rb +32 -0
  137. data/lib/oxidized/model/supermicro.rb +6 -41
  138. data/lib/oxidized/model/timos.rb +6 -114
  139. data/lib/oxidized/model/tmos.rb +1 -3
  140. data/lib/oxidized/model/tplink.rb +7 -11
  141. data/lib/oxidized/model/trango.rb +6 -7
  142. data/lib/oxidized/model/ucs.rb +0 -1
  143. data/lib/oxidized/model/voltaire.rb +3 -6
  144. data/lib/oxidized/model/voss.rb +1 -2
  145. data/lib/oxidized/model/vrp.rb +4 -5
  146. data/lib/oxidized/model/vyatta.rb +6 -4
  147. data/lib/oxidized/model/weos.rb +1 -3
  148. data/lib/oxidized/model/xos.rb +6 -5
  149. data/lib/oxidized/model/zhoneolt.rb +2 -2
  150. data/lib/oxidized/model/zynos.rb +1 -3
  151. data/lib/oxidized/model/zynoscli.rb +36 -0
  152. data/lib/oxidized/node.rb +11 -11
  153. data/lib/oxidized/node/stats.rb +15 -2
  154. data/lib/oxidized/nodes.rb +8 -8
  155. data/lib/oxidized/output/file.rb +41 -42
  156. data/lib/oxidized/output/git.rb +113 -115
  157. data/lib/oxidized/output/gitcrypt.rb +241 -242
  158. data/lib/oxidized/output/http.rb +23 -27
  159. data/lib/oxidized/output/output.rb +1 -2
  160. data/lib/oxidized/source/csv.rb +44 -45
  161. data/lib/oxidized/source/http.rb +52 -49
  162. data/lib/oxidized/source/source.rb +6 -7
  163. data/lib/oxidized/source/sql.rb +55 -51
  164. data/lib/oxidized/string.rb +3 -4
  165. data/lib/oxidized/version.rb +17 -1
  166. data/lib/oxidized/worker.rb +12 -3
  167. data/oxidized.gemspec +19 -13
  168. metadata +139 -51
  169. data/.ruby-version +0 -1
  170. data/Gemfile.lock +0 -44
@@ -0,0 +1,51 @@
1
+ # Developed against:
2
+ # #show version
3
+ # Switch ID Hardware Version Firmware Version
4
+ # 0 SSE-G48-TG4 (P2-01) 1.0.16-9
5
+
6
+ class AricentISS < Oxidized::Model
7
+ prompt (/^(\e\[27m)?[ \r]*[\w-]+# ?$/)
8
+
9
+ cfg :ssh do
10
+ # "pagination" was misspelled in some (earlier) versions (at least 1.0.16-9)
11
+ # 1.0.18-15 is known to include the corrected spelling
12
+ post_login 'no cli pagination'
13
+ post_login 'no cli pagignation'
14
+ pre_logout 'exit'
15
+ end
16
+
17
+ cmd :all do |cfg|
18
+ # * Drop first line that contains the command, and the last line that
19
+ # contains a prompt
20
+ # * Strip carriage returns
21
+ cfg.delete("\r").each_line.to_a[1..-2].join
22
+ end
23
+
24
+ cmd :secret do |cfg|
25
+ cfg.gsub(/^(snmp community) .*/, '\1 <hidden>')
26
+ end
27
+
28
+ cmd 'show system information' do |cfg|
29
+ cfg.sub! /^Device Up Time.*\n/, ''
30
+ cfg.delete! "\r"
31
+ comment(cfg).gsub(/ +$/, '')
32
+ end
33
+
34
+ cmd 'show running-config' do |cfg|
35
+ comment_next = 0
36
+ cfg.each_line.map { |l|
37
+ next '' if l.match /^Building configuration/
38
+
39
+ if l.match /^Switch ID.*Hardware Version.*Firmware Version/ then
40
+ comment_next = 2
41
+ end
42
+
43
+ if comment_next > 0 then
44
+ comment_next -= 1
45
+ next comment(l)
46
+ end
47
+
48
+ l
49
+ }.join.gsub(/ +$/, '')
50
+ end
51
+ end
@@ -1,5 +1,4 @@
1
1
  class ASA < Oxidized::Model
2
-
3
2
  # Cisco ASA model #
4
3
  # Only SSH supported for the sake of security
5
4
 
@@ -27,7 +26,7 @@ class ASA < Oxidized::Model
27
26
 
28
27
  cmd 'show version' do |cfg|
29
28
  # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
30
- cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
29
+ cfg = cfg.each_line.reject { |line| line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
31
30
  cfg = cfg.join
32
31
  comment cfg
33
32
  end
@@ -54,48 +53,47 @@ class ASA < Oxidized::Model
54
53
  post_login 'terminal pager 0'
55
54
  pre_logout 'exit'
56
55
  end
57
-
56
+
58
57
  def single_context
59
- # Single context mode
60
- cmd 'more system:running-config' do |cfg|
61
- cfg = cfg.each_line.to_a[3..-1].join
62
- cfg.gsub! /^: [^\n]*\n/, ''
63
- # backup any xml referenced in the configuration.
64
- anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
65
- anyconnect_profiles.each do |profile|
66
- cfg << (comment profile + "\n" )
67
- cmd ("more" + profile) do |xml|
68
- cfg << (comment xml)
69
- end
58
+ # Single context mode
59
+ cmd 'more system:running-config' do |cfg|
60
+ cfg = cfg.each_line.to_a[3..-1].join
61
+ cfg.gsub! /^: [^\n]*\n/, ''
62
+ # backup any xml referenced in the configuration.
63
+ anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
64
+ anyconnect_profiles.each do |profile|
65
+ cfg << (comment profile + "\n")
66
+ cmd ("more" + profile) do |xml|
67
+ cfg << (comment xml)
70
68
  end
71
- # if DAP is enabled, also backup dap.xml
72
- if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
73
- cfg << (comment "disk0:/dap.xml\n")
74
- cmd "more disk0:/dap.xml" do |xml|
75
- cfg << (comment xml)
76
- end
69
+ end
70
+ # if DAP is enabled, also backup dap.xml
71
+ if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
72
+ cfg << (comment "disk0:/dap.xml\n")
73
+ cmd "more disk0:/dap.xml" do |xml|
74
+ cfg << (comment xml)
77
75
  end
78
- cfg
79
76
  end
77
+ cfg
78
+ end
80
79
  end
81
80
 
82
81
  def multiple_context
83
- # Multiple context mode
84
- cmd 'changeto system' do |cfg|
85
- cmd 'show running-config' do |systemcfg|
86
- allcfg = "\n\n" + systemcfg + "\n\n"
87
- contexts = systemcfg.scan(/^context (\S+)$/)
88
- files = systemcfg.scan(/config-url (\S+)$/)
89
- contexts.each_with_index do |cont, i|
90
- allcfg = allcfg + "\n\n----------========== [ CONTEXT " + cont.join(" ") + " FILE " + files[i].join(" ") + " ] ==========----------\n\n"
91
- cmd "more " + files[i].join(" ") do |cfgcontext|
92
- allcfg = allcfg + "\n\n" + cfgcontext
93
- end
82
+ # Multiple context mode
83
+ cmd 'changeto system' do |cfg|
84
+ cmd 'show running-config' do |systemcfg|
85
+ allcfg = "\n\n" + systemcfg + "\n\n"
86
+ contexts = systemcfg.scan(/^context (\S+)$/)
87
+ files = systemcfg.scan(/config-url (\S+)$/)
88
+ contexts.each_with_index do |cont, i|
89
+ allcfg = allcfg + "\n\n----------========== [ CONTEXT " + cont.join(" ") + " FILE " + files[i].join(" ") + " ] ==========----------\n\n"
90
+ cmd "more " + files[i].join(" ") do |cfgcontext|
91
+ allcfg = allcfg + "\n\n" + cfgcontext
94
92
  end
95
- cfg = allcfg
96
93
  end
97
- cfg
94
+ cfg = allcfg
98
95
  end
96
+ cfg
97
+ end
99
98
  end
100
-
101
99
  end
@@ -1,49 +1,46 @@
1
1
  class AsyncOS < Oxidized::Model
2
+ # ESA prompt "(mail.example.com)> " or "mail.example.com> "
3
+ prompt /^\r*([(]?[\w. ]+[)]?[#>]\s+)$/
4
+ comment '! '
2
5
 
3
- # ESA prompt "(mail.example.com)> "
4
- prompt /^\r*([(][\w. ]+[)][#>]\s+)$/
5
- comment '! '
6
-
7
- # Select passphrase display option
8
- expect /\[\S+\]>\s/ do |data, re|
9
- send "3\n"
10
- data.sub re, ''
11
- end
12
-
13
- # handle paging
14
- expect /-Press Any Key For More-+.*$/ do |data, re|
15
- send " "
16
- data.sub re, ''
17
- end
18
-
19
- cmd 'version' do |cfg|
20
- comment cfg
21
- end
6
+ # Select passphrase display option
7
+ expect /\[\S+\]>\s/ do |data, re|
8
+ send "3\n"
9
+ data.sub re, ''
10
+ end
22
11
 
23
- cmd 'showconfig' do |cfg|
24
- #Delete hour and date which change each run
25
- #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
26
- # Delete select passphrase display option
27
- cfg.gsub! /Choose the passphrase option:/, ''
28
- cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, ''
29
- cfg.gsub! /loadconfig command\)/, ''
30
- cfg.gsub! /2. Encrypt passphrases/, ''
31
- cfg.gsub! /3. Plain passphrases/, ''
32
- cfg.gsub! /^3$/, ''
33
- #Delete space
34
- cfg.gsub! /\n\s{25,26}/, ''
35
- #Delete after line
36
- cfg.gsub! /([-\\\/,.\w><@]+)(\s{25,27})/,"\\1"
37
- # Add a carriage return
38
- cfg.gsub! /([-\\\/,.\w><@]+)(\s{6})([-\\\/,.\w><@]+)/,"\\1\n\\2\\3"
39
- # Delete prompt
40
- cfg.gsub! /^\r*([(][\w. ]+[)][#>]\s+)$/, ''
41
- cfg
12
+ # handle paging
13
+ expect /-Press Any Key For More-+.*$/ do |data, re|
14
+ send " "
15
+ data.sub re, ''
16
+ end
42
17
 
43
- end
44
-
45
- cfg :ssh do
46
- pre_logout "exit"
47
- end
48
-
18
+ cmd 'version' do |cfg|
19
+ comment cfg
20
+ end
21
+
22
+ cmd 'showconfig' do |cfg|
23
+ # Delete hour and date which change each run
24
+ # cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
25
+ # Delete select passphrase display option
26
+ cfg.gsub! /Choose the passphrase option:/, ''
27
+ cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, ''
28
+ cfg.gsub! /loadconfig command\)/, ''
29
+ cfg.gsub! /2. Encrypt passphrases/, ''
30
+ cfg.gsub! /3. Plain passphrases/, ''
31
+ cfg.gsub! /^3$/, ''
32
+ # Delete space
33
+ cfg.gsub! /\n\s{25,26}/, ''
34
+ # Delete after line
35
+ cfg.gsub! /([-\\\/,.\w><@]+)(\s{25,27})/, "\\1"
36
+ # Add a carriage return
37
+ cfg.gsub! /([-\\\/,.\w><@]+)(\s{6})([-\\\/,.\w><@]+)/, "\\1\n\\2\\3"
38
+ # Delete prompt
39
+ cfg.gsub! /^\r*([(][\w. ]+[)][#>]\s+)$/, ''
40
+ cfg
41
+ end
42
+
43
+ cfg :ssh do
44
+ pre_logout "exit"
45
+ end
49
46
  end
@@ -1,20 +1,17 @@
1
1
  class AudioCodes < Oxidized::Model
2
-
3
- # Pull config from AudioCodes Mediant devices from version > 7.0
2
+ # Pull config from AudioCodes Mediant devices from version > 7.0
4
3
 
5
4
  prompt /^\r?([\w.@() -]+[#>]\s?)$/
6
- comment '## '
5
+ comment '## '
7
6
 
8
7
  expect /\s*--MORE--$/ do |data, re|
9
-
10
8
  send ' '
11
9
 
12
10
  data.sub re, ''
13
-
14
11
  end
15
12
 
16
13
  cmd 'show running-config' do |cfg|
17
- cfg
14
+ cfg
18
15
  end
19
16
 
20
17
  cfg :ssh do
@@ -22,11 +19,10 @@ class AudioCodes < Oxidized::Model
22
19
  password /^.+password:\s$/
23
20
  pre_logout 'exit'
24
21
  end
25
-
22
+
26
23
  cfg :telnet do
27
24
  username /^Username:\s$/
28
25
  password /^Password:\s$/
29
26
  pre_logout 'exit'
30
27
  end
31
-
32
28
  end
@@ -0,0 +1,84 @@
1
+ class AWPlus < Oxidized::Model
2
+ # Allied Telesis Alliedware Plus Model#
3
+ # https://www.alliedtelesis.com/products/software/AlliedWare-Plus
4
+
5
+ prompt /^(\r?[\w.@:\/-]+[#>]\s?)$/
6
+ comment '! '
7
+
8
+ # Avoids needing "term length 0" to display full config file.
9
+ expect /--More--/ do |data, re|
10
+ send ' '
11
+ data.sub re, ''
12
+ end
13
+
14
+ # Removes gibberish pager output e.g. VT100 escape codes
15
+ cmd :all do |cfg|
16
+ cfg.gsub! /\e\[K/, '' # example how to handle pager - cleareol EL0
17
+ cfg.gsub! /\e\[7m\e\[m/, '' # example how to handle pager - Reverse SGR7
18
+ cfg.gsub! /\r/, '' # Filters rogue ^M - see issue #415
19
+ cfg.each_line.to_a[1..-2].join
20
+ end
21
+
22
+ # Remove passwords from config file.
23
+ # Add vars "remove_secret: true" to global oxidized config file to enable.
24
+
25
+ cmd :secret do |cfg|
26
+ cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
27
+ cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>'
28
+ cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>'
29
+ cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>'
30
+ cfg.gsub! /^(enable (password|secret) \d) (\S+)/, '\\1 <secret hidden>'
31
+ cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
32
+ cfg.gsub! /^(tacacs-server key \d) (\S+)/, '\\1 <secret hidden>'
33
+ cfg
34
+ end
35
+
36
+ # Adds "Show system" output to start of config.
37
+
38
+ cmd 'Show System' do |cfg|
39
+ comment cfg.insert(0, "--------------------------------------------------------------------------------! \n")
40
+ # Unhash below to write a comment in the config file.
41
+ cfg.insert(0, "Starting: Show system cmd \n")
42
+ cfg << "\n \nEnding: show system cmd"
43
+ comment cfg << "\n--------------------------------------------------------------------------------! \n \n"
44
+ # Removes the following lines from "show system" in output file. This ensures oxidized diffs are meaningful.
45
+ comment cfg.each_line.reject { |line|
46
+ line.match /^$\n/ or # Remove blank lines in "sh sys"
47
+ line.match /System Status\s*.*/ or
48
+ line.match /RAM\s*:.*/ or
49
+ line.match /Uptime\s*:.*/ or
50
+ line.match /Flash\s*:.*/ or
51
+ line.match /Current software\s*:.*/ or
52
+ line.match /Software version\s*:.*/ or
53
+ line.match /Build date\s*:.*/
54
+ } .join
55
+ end
56
+
57
+ # Actually get the devices running config#
58
+ cmd 'show running-config' do |cfg|
59
+ cfg
60
+ end
61
+
62
+ # Config required for telnet to detect username prompt
63
+ cfg :telnet do
64
+ username /login:\s/
65
+ end
66
+
67
+ # Main login config
68
+ cfg :telnet, :ssh do
69
+ post_login do
70
+ if vars :enable
71
+ send "enable\n"
72
+ expect /^Password:\s/
73
+ cmd vars(:enable) + "\r\n"
74
+ else
75
+ cmd 'enable' # Required for Priv-Exec users without enable PW to be put into "enable mode".
76
+ end
77
+ # cmd 'terminal length 0' #set so the entire config is output without intervention.
78
+ end
79
+ pre_logout do
80
+ # cmd 'terminal no length' #Sets term length back to default on exit.
81
+ send "exit\r\n"
82
+ end
83
+ end
84
+ end
@@ -1,5 +1,5 @@
1
1
  class Boss < Oxidized::Model
2
- # Avaya Baystack Operating System Software(BOSS)
2
+ # Extreme Baystack Operating System Software(BOSS)
3
3
  # Created by danielcoxman@gmail.com
4
4
  # May 15, 2017
5
5
  # This was tested on ers3510, ers5530, ers4850, ers5952
@@ -16,7 +16,7 @@ class Boss < Oxidized::Model
16
16
  data.sub re, ''
17
17
  end
18
18
 
19
- # Handle the Failed retries since last login
19
+ # Handle the Failed retries since last login
20
20
  # no known way to disable other than to implement radius authentication
21
21
  expect /Press ENTER to continue/ do |data, re|
22
22
  send "\n"
@@ -28,8 +28,10 @@ class Boss < Oxidized::Model
28
28
  expect /ommand Line Interface\.\.\./ do |data, re|
29
29
  send "c"
30
30
  data.sub re, ''
31
+ send "\n"
32
+ data.sub re, ''
31
33
  end
32
-
34
+
33
35
  # needed for proper formatting
34
36
  cmd('') { |cfg| comment "#{cfg}\n" }
35
37
 
@@ -43,7 +45,7 @@ class Boss < Oxidized::Model
43
45
  cfg.gsub! /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} .*/, ''
44
46
  comment "#{cfg}\n"
45
47
  end
46
-
48
+
47
49
  # if a stack then collect the stacking information
48
50
  cmd 'show stack-info' do |cfg|
49
51
  if @stack
@@ -72,5 +74,4 @@ class Boss < Oxidized::Model
72
74
  post_login 'terminal length 0'
73
75
  post_login 'terminal width 132'
74
76
  end
75
-
76
77
  end
@@ -1,45 +1,43 @@
1
-
2
- class BR6910 < Oxidized::Model
3
-
4
- prompt /^Vty-[0-9]\#$/
5
- comment '! '
6
-
7
- # not possible to disable paging prior to show running-config
8
- expect /^((.*)Others to exit ---(.*))$/ do |data, re|
9
- send 'a'
10
- data.sub re, ''
11
- end
12
-
13
- cmd :all do |cfg|
14
- # sometimes br6910s inserts arbitrary whitespace after commands are
15
- # issued on the CLI, from run to run. this normalises the output.
16
- cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join
17
- end
18
-
19
- cmd 'show version' do |cfg|
20
- comment cfg
21
- end
22
-
23
- # show flash is not possible on a brocade 6910, do dir instead
24
- # to see flash contents (includes config file names)
25
- cmd 'dir' do |cfg|
26
- comment cfg
27
- end
28
-
29
- cmd 'show running-config' do |cfg|
30
- arr = cfg.each_line.to_a
31
- arr[2..-1].join unless arr.length < 2
32
- end
33
-
34
- cfg :telnet do
35
- username /^Username:/
36
- password /^Password:/
37
- end
38
-
39
- # post login and post logout
40
- cfg :telnet, :ssh do
41
- post_login ''
42
- pre_logout 'exit'
43
- end
44
-
45
- end
1
+
2
+ class BR6910 < Oxidized::Model
3
+ prompt /^([\w.@()-]+[#>]\s?)$/
4
+ comment '! '
5
+
6
+ # not possible to disable paging prior to show running-config
7
+ expect /^((.*)Others to exit ---(.*))$/ do |data, re|
8
+ send 'a'
9
+ data.sub re, ''
10
+ end
11
+
12
+ cmd :all do |cfg|
13
+ # sometimes br6910s inserts arbitrary whitespace after commands are
14
+ # issued on the CLI, from run to run. this normalises the output.
15
+ cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join
16
+ end
17
+
18
+ cmd 'show version' do |cfg|
19
+ comment cfg
20
+ end
21
+
22
+ # show flash is not possible on a brocade 6910, do dir instead
23
+ # to see flash contents (includes config file names)
24
+ cmd 'dir' do |cfg|
25
+ comment cfg
26
+ end
27
+
28
+ cmd 'show running-config' do |cfg|
29
+ arr = cfg.each_line.to_a
30
+ arr[2..-1].join unless arr.length < 2
31
+ end
32
+
33
+ cfg :telnet do
34
+ username /^Username:/
35
+ password /^Password:/
36
+ end
37
+
38
+ # post login and post logout
39
+ cfg :telnet, :ssh do
40
+ post_login ''
41
+ pre_logout 'exit'
42
+ end
43
+ end