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
@@ -1,5 +1,4 @@
1
1
  class Siklu < Oxidized::Model
2
-
3
2
  # Siklu EtherHaul #
4
3
 
5
4
  prompt /^[\w-]+>$/
@@ -15,5 +14,4 @@ class Siklu < Oxidized::Model
15
14
  cfg :ssh do
16
15
  pre_logout 'exit'
17
16
  end
18
-
19
17
  end
@@ -0,0 +1,59 @@
1
+ class SLXOS < Oxidized::Model
2
+ prompt /^.*[>#]\s?$/i
3
+ comment '! '
4
+
5
+ cmd 'show version' do |cfg|
6
+ cfg.gsub! /(^((.*)[Ss]ystem [Uu]ptime(.*))$)/, '' # remove unwanted line system uptime
7
+ cfg.gsub! /[Uu]p\s?[Tt]ime is .*/, ''
8
+
9
+ comment cfg
10
+ end
11
+
12
+ cmd 'show chassis' do |cfg|
13
+ cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) # sometimes ironware returns broken encoding
14
+ cfg.gsub! /.*Power Usage.*/, '' # remove unwanted lines power usage
15
+ cfg.gsub! /Time A(live|wake).*/, '' # remove unwanted lines time alive/awake
16
+ cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
17
+
18
+ comment cfg
19
+ end
20
+
21
+ cmd 'show system' do |cfg|
22
+ cfg.gsub! /Up Time.*/, '' # removes uptime line
23
+ cfg.gsub! /Current Time.*/, '' # remove current time line
24
+ cfg.gsub! /.*speed is.*/, '' # removes fan speed lines
25
+
26
+ comment cfg
27
+ end
28
+
29
+ cmd 'show slots' do |cfg|
30
+ cfg.gsub! /^-*^$/, '' # some slx devices are fixed config
31
+ cfg.gsub! /syntax error: element does not exist/, '' # same as above
32
+
33
+ comment cfg
34
+ end
35
+
36
+ cmd 'show running-config' do |cfg|
37
+ arr = cfg.each_line.to_a
38
+ arr[2..-1].join unless arr.length < 2
39
+ end
40
+
41
+ cfg :telnet do
42
+ # match expected prompts
43
+ username /^(Please Enter Login Name|Username):/
44
+ password /^(Please Enter Password ?|Password):/
45
+ end
46
+
47
+ # handle pager with enable
48
+ cfg :telnet, :ssh do
49
+ if vars :enable
50
+ post_login do
51
+ send "enable\n"
52
+ cmd vars(:enable)
53
+ end
54
+ end
55
+ post_login ''
56
+ post_login 'terminal length 0'
57
+ pre_logout 'exit'
58
+ end
59
+ end
@@ -0,0 +1,117 @@
1
+ class SROS < Oxidized::Model
2
+ #
3
+ # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
4
+ # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
5
+ #
6
+
7
+ comment '# '
8
+
9
+ prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
10
+
11
+ cmd :all do |cfg, cmdstring|
12
+ new_cfg = comment "COMMAND: #{cmdstring}\n"
13
+ new_cfg << cfg.each_line.to_a[1..-2].join
14
+ end
15
+
16
+ #
17
+ # Show the boot options file.
18
+ #
19
+ cmd 'show bof' do |cfg|
20
+ cfg.gsub! /# Finished .*/, ''
21
+ cfg.gsub! /# Generated .*/, ''
22
+ comment cfg
23
+ end
24
+
25
+ #
26
+ # Show the system information.
27
+ #
28
+ cmd 'show system information' do |cfg|
29
+ #
30
+ # Strip uptime.
31
+ #
32
+ cfg.sub! /^System Up Time.*\n/, ''
33
+ cfg.gsub! /# Finished .*/, ''
34
+ cfg.gsub! /# Generated .*/, ''
35
+ comment cfg
36
+ end
37
+
38
+ #
39
+ # Show the card state.
40
+ #
41
+ cmd 'show card state' do |cfg|
42
+ cfg.gsub! /# Finished .*/, ''
43
+ cfg.gsub! /# Generated .*/, ''
44
+ comment cfg
45
+ end
46
+
47
+ #
48
+ # Show the boot log.
49
+ #
50
+ cmd 'file type bootlog.txt' do |cfg|
51
+ #
52
+ # Strip carriage returns and backspaces.
53
+ #
54
+ cfg.gsub! /\r/, ''
55
+ cfg.gsub! /[\b][\b][\b]/, "\n"
56
+ cfg.gsub! /# Finished .*/, ''
57
+ cfg.gsub! /# Generated .*/, ''
58
+ comment cfg
59
+ end
60
+
61
+ #
62
+ # Show the running debug configuration.
63
+ #
64
+ cmd 'show debug' do |cfg|
65
+ cfg.gsub! /# Finished .*/, ''
66
+ cfg.gsub! /# Generated .*/, ''
67
+ comment cfg
68
+ end
69
+
70
+ #
71
+ # Show the saved debug configuration (admin debug-save).
72
+ #
73
+ cmd 'file type config.dbg' do |cfg|
74
+ #
75
+ # Strip carriage returns.
76
+ #
77
+ cfg.gsub! /\r/, ''
78
+ cfg.gsub! /# Finished .*/, ''
79
+ cfg.gsub! /# Generated .*/, ''
80
+ comment cfg
81
+ end
82
+
83
+ #
84
+ # Show the running persistent indices.
85
+ #
86
+ cmd 'admin display-config index' do |cfg|
87
+ #
88
+ # Strip carriage returns.
89
+ #
90
+ cfg.gsub! /\r/, ''
91
+ cfg.gsub! /# Finished .*/, ''
92
+ cfg.gsub! /# Generated .*/, ''
93
+ comment cfg
94
+ end
95
+
96
+ #
97
+ # Show the running configuration.
98
+ #
99
+ cmd 'admin display-config' do |cfg|
100
+ #
101
+ # Strip carriage returns.
102
+ #
103
+ cfg.gsub! /\r/, ''
104
+ cfg.gsub! /# Finished .*/, ''
105
+ cfg.gsub! /# Generated .*/, ''
106
+ end
107
+
108
+ cfg :telnet do
109
+ username /^Login: /
110
+ password /^Password: /
111
+ end
112
+
113
+ cfg :telnet, :ssh do
114
+ post_login 'environment no more'
115
+ pre_logout 'logout'
116
+ end
117
+ end
@@ -0,0 +1,32 @@
1
+ class StoneOS < Oxidized::Model
2
+ # Hillstone Networks StoneOS software
3
+
4
+ prompt /^\r?[\w.()-]+[#>](\s)?$/
5
+ comment '# '
6
+
7
+ expect /^\s.*--More--.*$/ do |data, re|
8
+ send ' '
9
+ data.sub re, ''
10
+ end
11
+
12
+ cmd :all do |cfg|
13
+ cfg.each_line.to_a[1..-2].join
14
+ end
15
+
16
+ cmd 'show configuration running'
17
+
18
+ cmd 'show version' do |cfg|
19
+ comment cfg
20
+ end
21
+
22
+ cfg :telnet do
23
+ username(/^login:/)
24
+ password(/^Password:/)
25
+ end
26
+
27
+ cfg :telnet, :ssh do
28
+ post_login 'terminal length 256'
29
+ post_login 'terminal width 512'
30
+ pre_logout 'exit'
31
+ end
32
+ end
@@ -1,45 +1,10 @@
1
- class Supermicro < Oxidized::Model
2
- comment '! '
1
+ # Backward compatibility shim for deprecated model `supermicro`.
2
+ # Migrate your source from `supermicro` to `edgecos`.
3
3
 
4
- cmd :secret do |cfg|
5
- cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>')
6
- cfg.gsub!(/community (\S+)/, 'community <hidden>')
7
- cfg
8
- end
4
+ require_relative 'edgecos.rb'
9
5
 
10
- cmd :all do |cfg|
11
- cfg.each_line.to_a[2..-2].join
12
- end
6
+ Supermicro = EdgeCOS
13
7
 
14
- cmd 'show running-config'
8
+ Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead."
15
9
 
16
- cmd 'show access-list tcam-utilization' do |cfg|
17
- comment cfg
18
- end
19
-
20
- cmd 'show memory' do |cfg|
21
- comment cfg
22
- end
23
-
24
- cmd 'show system' do |cfg|
25
- comment cfg
26
- end
27
-
28
- cmd 'show version' do |cfg|
29
- comment cfg
30
- end
31
-
32
- cmd 'show watchdog' do |cfg|
33
- comment cfg
34
- end
35
-
36
- cfg :telnet do
37
- username /^Username:/
38
- password /^Password:/
39
- end
40
-
41
- cfg :telnet, :ssh do
42
- post_login 'terminal length 0'
43
- pre_logout 'exit'
44
- end
45
- end
10
+ # Deprecated
@@ -1,118 +1,10 @@
1
- class TiMOS < Oxidized::Model
1
+ # Backward compatibility shim for deprecated model `timos`.
2
+ # Migrate your source from `timos` to `sros`.
2
3
 
3
- #
4
- # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
5
- # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
6
- #
4
+ require_relative 'sros.rb'
7
5
 
8
- comment '# '
6
+ TiMOS = SROS
9
7
 
10
- prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
8
+ Oxidized.logger.warn "Using deprecated model timos, use sros instead."
11
9
 
12
- cmd :all do |cfg, cmdstring|
13
- new_cfg = comment "COMMAND: #{cmdstring}\n"
14
- new_cfg << cfg.each_line.to_a[1..-2].join
15
- end
16
-
17
- #
18
- # Show the boot options file.
19
- #
20
- cmd 'show bof' do |cfg|
21
- cfg.gsub! /# Finished .*/, ''
22
- cfg.gsub! /# Generated .*/, ''
23
- comment cfg
24
- end
25
-
26
- #
27
- # Show the system information.
28
- #
29
- cmd 'show system information' do |cfg|
30
- #
31
- # Strip uptime.
32
- #
33
- cfg.sub! /^System Up Time.*\n/, ''
34
- cfg.gsub! /# Finished .*/, ''
35
- cfg.gsub! /# Generated .*/, ''
36
- comment cfg
37
- end
38
-
39
- #
40
- # Show the card state.
41
- #
42
- cmd 'show card state' do |cfg|
43
- cfg.gsub! /# Finished .*/, ''
44
- cfg.gsub! /# Generated .*/, ''
45
- comment cfg
46
- end
47
-
48
- #
49
- # Show the boot log.
50
- #
51
- cmd 'file type bootlog.txt' do |cfg|
52
- #
53
- # Strip carriage returns and backspaces.
54
- #
55
- cfg.gsub! /\r/, ''
56
- cfg.gsub! /[\b][\b][\b]/, "\n"
57
- cfg.gsub! /# Finished .*/, ''
58
- cfg.gsub! /# Generated .*/, ''
59
- comment cfg
60
- end
61
-
62
- #
63
- # Show the running debug configuration.
64
- #
65
- cmd 'show debug' do |cfg|
66
- cfg.gsub! /# Finished .*/, ''
67
- cfg.gsub! /# Generated .*/, ''
68
- comment cfg
69
- end
70
-
71
- #
72
- # Show the saved debug configuration (admin debug-save).
73
- #
74
- cmd 'file type config.dbg' do |cfg|
75
- #
76
- # Strip carriage returns.
77
- #
78
- cfg.gsub! /\r/, ''
79
- cfg.gsub! /# Finished .*/, ''
80
- cfg.gsub! /# Generated .*/, ''
81
- comment cfg
82
- end
83
-
84
- #
85
- # Show the running persistent indices.
86
- #
87
- cmd 'admin display-config index' do |cfg|
88
- #
89
- # Strip carriage returns.
90
- #
91
- cfg.gsub! /\r/, ''
92
- cfg.gsub! /# Finished .*/, ''
93
- cfg.gsub! /# Generated .*/, ''
94
- comment cfg
95
- end
96
-
97
- #
98
- # Show the running configuration.
99
- #
100
- cmd 'admin display-config' do |cfg|
101
- #
102
- # Strip carriage returns.
103
- #
104
- cfg.gsub! /\r/, ''
105
- cfg.gsub! /# Finished .*/, ''
106
- cfg.gsub! /# Generated .*/, ''
107
- end
108
-
109
- cfg :telnet do
110
- username /^Login: /
111
- password /^Password: /
112
- end
113
-
114
- cfg :telnet, :ssh do
115
- post_login 'environment no more'
116
- pre_logout 'logout'
117
- end
118
- end
10
+ # Deprecated
@@ -1,5 +1,4 @@
1
1
  class TMOS < Oxidized::Model
2
-
3
2
  comment '# '
4
3
 
5
4
  cmd :secret do |cfg|
@@ -46,7 +45,6 @@ class TMOS < Oxidized::Model
46
45
  cmd('cat /config/partitions/*/bigip.conf') { |cfg| comment cfg }
47
46
 
48
47
  cfg :ssh do
49
- exec true # don't run shell, run each command in exec channel
48
+ exec true # don't run shell, run each command in exec channel
50
49
  end
51
-
52
50
  end
@@ -1,26 +1,25 @@
1
1
  class TPLink < Oxidized::Model
2
-
3
2
  # tp-link prompt
4
3
  prompt /^\r?([\w.@()-]+[#>]\s?)$/
5
- comment '! '
4
+ comment '! '
6
5
 
7
6
  # handle paging
8
7
  # workaround for sometimes missing whitespaces with "\s?"
9
8
  expect /Press\s?any\s?key\s?to\s?continue\s?\(Q\s?to\s?quit\)/ do |data, re|
10
- send ' '
11
- data.sub re, ''
9
+ send ' '
10
+ data.sub re, ''
12
11
  end
13
12
 
14
13
  # send carriage return because \n with the command is not enough
15
14
  # checks if line ends with prompt >,# or \r,\nm otherwise send \r
16
15
  expect /[^>#\r\n]$/ do |data, re|
17
- send "\r"
18
- data.sub re, ''
16
+ send "\r"
17
+ data.sub re, ''
19
18
  end
20
19
 
21
20
  cmd :all do |cfg|
22
21
  # normalize linefeeds
23
- cfg.gsub! /(\r|\r\n|\n\r)/,"\n"
22
+ cfg.gsub! /(\r|\r\n|\n\r)/, "\n"
24
23
  # remove empty lines
25
24
  cfg.each_line.reject { |line| line.match /^[\r\n\s\u0000#]+$/ }.join
26
25
  end
@@ -31,7 +30,7 @@ class TPLink < Oxidized::Model
31
30
  cfg
32
31
  end
33
32
 
34
- cmd 'show system-info' do |cfg|
33
+ cmd 'show system-info' do |cfg|
35
34
  comment cfg.each_line.to_a[3..-3].join
36
35
  end
37
36
 
@@ -58,8 +57,5 @@ class TPLink < Oxidized::Model
58
57
  send "exit\r"
59
58
  send "logout\r"
60
59
  end
61
-
62
60
  end
63
-
64
61
  end
65
-