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,12 @@
1
+ Cisco WLC Configuration
2
+ =======================
3
+
4
+ Create a user with read-write privilege:
5
+
6
+ ```text
7
+ mgmtuser add oxidized **** read-write
8
+ ```
9
+
10
+ Oxidized needs read-write privilege in order to execute 'config paging disable'.
11
+
12
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,12 @@
1
+ Arbor Networks ArbOS notes
2
+ ==========================
3
+
4
+ If you are running ArbOS version 7 or lower then you may need to update the model to remove `exec true`:
5
+
6
+ ```ruby
7
+ cfg :ssh do
8
+ pre_logout 'exit'
9
+ end
10
+ ```
11
+
12
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,14 @@
1
+ Comware Configuration
2
+ =====================
3
+
4
+ If you find 3Com Comware devices aren't being backed up this may be due to prompt detection not matching because a previous login message is disabled after the first prompt.
5
+
6
+ You can disable this on the devices themselves by running this command:
7
+
8
+ ```text
9
+ info-center source default channel 1 log state off debug state off
10
+ ```
11
+
12
+ [Reference](https://github.com/ytti/oxidized/issues/1171)
13
+
14
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,9 @@
1
+ Arista EOS Configuration
2
+ ========================
3
+
4
+ By default EOS requires keyboard-interactive to be added to your Oxidized config. You can avoid having to do this by configuring the following on the EOS device:
5
+
6
+ ```
7
+ management ssh
8
+ authentication mode password
9
+ ```
@@ -0,0 +1,34 @@
1
+ JunOS Configuration
2
+ ===================
3
+
4
+ Create login class cfg-view
5
+
6
+ ```text
7
+ set system login class cfg-view permissions view-configuration
8
+ set system login class cfg-view allow-commands "(show)|(set cli screen-length)|(set cli screen-width)"
9
+ set system login class cfg-view deny-commands "(clear)|(file)|(file show)|(help)|(load)|(monitor)|(op)|(request)|(save)|(set)|(start)|(test)"
10
+ set system login class cfg-view deny-configuration all
11
+ ```
12
+
13
+ Create a user with cfg-view class
14
+
15
+ ```text
16
+ set system login user oxidized class cfg-view
17
+ set system login user oxidized authentication plain-text-password "verysecret"
18
+ ```
19
+
20
+ The commands Oxidized executes are:
21
+
22
+ 1. set cli screen-length 0
23
+ 2. set cli screen-width 0
24
+ 3. show configuration
25
+ 4. show version
26
+ 5. show chassis hardware
27
+ 6. show system license
28
+ 7. show system license keys (ex22|ex33|ex4|ex8|qfx only)
29
+ 8. show virtual-chassis (MX960 only)
30
+ 9. show chassis fabric reachability
31
+
32
+ Oxidized can now retrieve your configuration!
33
+
34
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,68 @@
1
+ Netgear Configuration
2
+ =====================
3
+
4
+ There are several models available with CLI management via telnet (port 60000), but they all behave like one of the following:
5
+ - older models:
6
+ ```
7
+ Connected to 192.168.3.201.
8
+
9
+ (GS748Tv4)
10
+ Applying Interface configuration, please wait ...admin
11
+ Password:********
12
+ (GS748Tv4) >enable
13
+ Password:
14
+
15
+ (GS748Tv4) #terminal length 0
16
+
17
+ (GS748Tv4) #show running-config
18
+ ```
19
+
20
+ - newer models:
21
+ ```
22
+ Connected to 172.0.3.203.
23
+
24
+ User:admin
25
+ Password:********
26
+ (GS724Tv4) >enable
27
+
28
+ (GS724Tv4) #terminal length 0
29
+
30
+ (GS724Tv4) #show running-config
31
+ ```
32
+
33
+ The main differences are:
34
+ - the prompt for username is different (looks quite strange for older models)
35
+ - enable password
36
+ - the older model prompts for enable password and it expects empty string
37
+ - the newer model does not prompt for enable password at all
38
+
39
+ Configuration for older/newer models: make sure you have defined variable 'enable':
40
+ - `'true'` for newer models
41
+ - `''` empty string: for older models
42
+
43
+ One possible configuration:
44
+ - oxidized config
45
+ ```yaml
46
+ source:
47
+ default: csv
48
+ csv:
49
+ file: "/home/oxidized/.config/oxidized/router.db"
50
+ delimiter: !ruby/regexp /:/
51
+ map:
52
+ name: 0
53
+ model: 1
54
+ username: 2
55
+ password: 3
56
+ vars_map:
57
+ enable: 4
58
+ telnet_port: 5
59
+ ```
60
+ - router.db
61
+ ```
62
+ switchOldFW:netgear:admin:adminpw::60000
63
+ switchNewFW:netgear:admin:adminpw:true:60000
64
+ ```
65
+
66
+ [Reference](https://github.com/ytti/oxidized/pull/1268)
67
+
68
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,19 @@
1
+ Model Notes
2
+ ===========
3
+
4
+ This directory contains implementation notes and caveats to assist you in your oxidized deployment.
5
+
6
+ Use the table below for more information on the Vendor/Model caveats.
7
+
8
+ Vendor | Model |Updated
9
+ ----------------|-----------------|----------------
10
+ 3COM|[Comware](Comware.md)|15 Feb 2018
11
+ AireOS|[AireOS](AireOS.md)|29 Nov 2017
12
+ Arbor Networks|[ArbOS](ArbOS.md)|27 Feb 2018
13
+ Arista|[EOS](EOS.md)|05 Feb 2018
14
+ Huawei|[VRP](VRP-Huawei.md)|17 Nov 2017
15
+ Juniper|[MX/QFX/EX/SRX/J Series](JunOS.md)|18 Jan 2018
16
+ Netgear|[Netgear](Netgear.md)|11 Apr 2018
17
+ Zyxel|[XGS4600 Series](XGS4600-Zyxel.md)|1 Feb 2018
18
+
19
+ If you discover additional caveats or problems please make sure to consult the [GitHub issues for oxidized](https://github.com/ytti/oxidized/issues) known issues.
@@ -3,12 +3,14 @@ Huawei VRP Configuration
3
3
 
4
4
  Create a user with no privileges
5
5
 
6
+ ```text
6
7
  <HUAWEI> system-view
7
8
  [~HUAWEI] aaa
8
9
  [~HUAWEI-aaa] local-user oxidized password irreversible-cipher verysecret
9
10
  [*HUAWEI-aaa] local-user oxidized level 1
10
11
  [*HUAWEI-aaa] local-user oxidized service-type terminal ssh
11
12
  [*HUAWEI-aaa] commit
13
+ ```
12
14
 
13
15
  The commands Oxidized executes are:
14
16
 
@@ -17,11 +19,17 @@ The commands Oxidized executes are:
17
19
  3. display device
18
20
  4. display current-configuration all
19
21
 
20
- Command 2 and 3 can be executed without issues, but 1 and 4 are only available for higher level users. Instead of making Oxidized a read/write user on your device, lower the priviledge-level for commands 1 and 4:
22
+ Command 2 and 3 can be executed without issues, but 1 and 4 are only available for higher level users. Instead of making Oxidized a read/write user on your device, lower the privilege-level for commands 1 and 4:
21
23
 
24
+ ```text
22
25
  <HUAWEI> system-view
23
26
  [~HUAWEI] command-privilege level 1 view global display current-configuration all
24
27
  [*HUAWEI] command-privilege level 1 view shell screen-length
25
28
  [*HUAWEI] commit
29
+ ```
26
30
 
27
- Oxidized can now retrieve your configuration!
31
+ Oxidized can now retrieve your configuration!
32
+
33
+ Caveat: Some versions of VRP default to appending a timestamp prior to the output of each `display` command, which will lead to superfluous updates. The configuration statement `timestamp disable` can be used to disable this functionality. (Issue #1218)
34
+
35
+ Back to [Model-Notes](README.md)
@@ -0,0 +1,39 @@
1
+ ZynOS Configuration
2
+ ===================
3
+
4
+ ## FTP
5
+
6
+ FTP access is only possible as admin, other users can login but cannot pull the files.
7
+ For the XGS4600 series the config file is _config_ and not _config-0_
8
+
9
+ The following line in _oxidized/lib/oxidized/model/zynos.rb_ will need changing
10
+
11
+ ```text
12
+ cmd 'config-0'
13
+ ```
14
+
15
+ The inclusion of an extra ftp option is also require. Within _input_ add the following
16
+
17
+ ```yaml
18
+ input:
19
+ ftp:
20
+ passive: false
21
+ ```
22
+
23
+
24
+ ## SSH/TelNet
25
+
26
+ Below is the table from the XGS4600 CLI Reference Guide (Version 3.79~4.50 Edition 1, 07/2017)
27
+ Take this table with a pinch of salt, level 3 will not allow _show running-config_!
28
+
29
+ Privilege Level | Types of commands at this privilege level
30
+ ----------------|-------------------------------------------
31
+ 0|Display basic system information.
32
+ 3|Display configuration or status.
33
+ 13|Configure features except for login accounts, SNMP user accounts, the authentication method sequence and authorization settings, multiple logins, administrator and enable passwords, and configuration information display.
34
+ 14|Configure login accounts, SNMP user accounts, the authentication method sequence and authorization settings, multiple logins, and administrator and enable passwords, and display configuration information.
35
+
36
+
37
+ Oxidized can now retrieve your configuration!
38
+
39
+ Back to [Model-Notes](README.md)
@@ -1,23 +1,22 @@
1
+ # Outputs
1
2
 
2
- ## Output
3
-
4
- ### Output: File
3
+ ## Output: File
5
4
 
6
5
  Parent directory needs to be created manually, one file per device, with most recent running config.
7
6
 
8
- ```
7
+ ```yaml
9
8
  output:
10
9
  file:
11
10
  directory: /var/lib/oxidized/configs
12
11
  ```
13
12
 
14
- ### Output: Git
13
+ ## Output: Git
15
14
 
16
15
  This uses the rugged/libgit2 interface. So you should remember that normal Git hooks will not be executed.
17
16
 
18
- For a single repositories for all devices:
17
+ For a single repository containing all devices:
19
18
 
20
- ``` yaml
19
+ ```yaml
21
20
  output:
22
21
  default: git
23
22
  git:
@@ -26,9 +25,9 @@ output:
26
25
  repo: "/var/lib/oxidized/devices.git"
27
26
  ```
28
27
 
29
- And for groups repositories:
28
+ And for group-based repositories:
30
29
 
31
- ``` yaml
30
+ ```yaml
32
31
  output:
33
32
  default: git
34
33
  git:
@@ -40,14 +39,14 @@ output:
40
39
  Oxidized will create a repository for each group in the same directory as the `default.git`. For
41
40
  example:
42
41
 
43
- ``` csv
42
+ ```csv
44
43
  host1:ios:first
45
44
  host2:nxos:second
46
45
  ```
47
46
 
48
47
  This will generate the following repositories:
49
48
 
50
- ``` bash
49
+ ```bash
51
50
  $ ls /var/lib/oxidized/git-repos
52
51
 
53
52
  default.git first.git second.git
@@ -55,7 +54,7 @@ default.git first.git second.git
55
54
 
56
55
  If you would like to use groups and a single repository, you can force this with the `single_repo` config.
57
56
 
58
- ``` yaml
57
+ ```yaml
59
58
  output:
60
59
  default: git
61
60
  git:
@@ -64,15 +63,14 @@ output:
64
63
 
65
64
  ```
66
65
 
67
- ### Output: Git-Crypt
66
+ ## Output: Git-Crypt
68
67
 
69
68
  This uses the gem git and system git-crypt interfaces. Have a look at [GIT-Crypt](https://www.agwa.name/projects/git-crypt/) documentation to know how to install it.
70
69
  Additionally to user and email informations, you have to provide the users ID that can be a key ID, a full fingerprint, an email address, or anything else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY A USER ID" in the gpg man page).
71
70
 
71
+ For a single repository containing all devices:
72
72
 
73
- For a single repositories for all devices:
74
-
75
- ``` yaml
73
+ ```yaml
76
74
  output:
77
75
  default: gitcrypt
78
76
  gitcrypt:
@@ -84,9 +82,9 @@ output:
84
82
  - "<user@example.com>"
85
83
  ```
86
84
 
87
- And for groups repositories:
85
+ And for group-based repositories:
88
86
 
89
- ``` yaml
87
+ ```yaml
90
88
  output:
91
89
  default: gitcrypt
92
90
  gitcrypt:
@@ -101,14 +99,14 @@ output:
101
99
  Oxidized will create a repository for each group in the same directory as the `default`. For
102
100
  example:
103
101
 
104
- ``` csv
102
+ ```csv
105
103
  host1:ios:first
106
104
  host2:nxos:second
107
105
  ```
108
106
 
109
107
  This will generate the following repositories:
110
108
 
111
- ``` bash
109
+ ```bash
112
110
  $ ls /var/lib/oxidized/git-repos
113
111
 
114
112
  default.git first.git second.git
@@ -116,7 +114,7 @@ default.git first.git second.git
116
114
 
117
115
  If you would like to use groups and a single repository, you can force this with the `single_repo` config.
118
116
 
119
- ``` yaml
117
+ ```yaml
120
118
  output:
121
119
  default: gitcrypt
122
120
  gitcrypt:
@@ -130,11 +128,12 @@ output:
130
128
 
131
129
  Please note that user list is only updated once at creation.
132
130
 
133
- ### Output: Http
131
+ ## Output: Http
134
132
 
135
- POST a config to the specified URL
133
+ The HTTP output will POST a config to the specified HTTP URL. Basic username/password authentication is supported.
136
134
 
137
- ```
135
+ Example HTTP output configuration:
136
+ ```yaml
138
137
  output:
139
138
  default: http
140
139
  http:
@@ -143,13 +142,13 @@ output:
143
142
  url: "http://192.168.162.50:8080/db/coll"
144
143
  ```
145
144
 
146
- ### Output types
145
+ ## Output types
147
146
 
148
147
  If you prefer to have different outputs in different files and/or directories, you can easily do this by modifying the corresponding model. To change the behaviour for IOS, you would edit `lib/oxidized/model/ios.rb` (run `gem contents oxidized` to find out the full file path).
149
148
 
150
149
  For example, let's say you want to split out `show version` and `show inventory` into separate files in a directory called `nodiff` which your tools will not send automated diffstats for. You can apply a patch along the lines of
151
150
 
152
- ```
151
+ ```text
153
152
  - cmd 'show version' do |cfg|
154
153
  - comment cfg.lines.first
155
154
  + cmd 'show version' do |state|
@@ -183,8 +182,8 @@ For example, let's say you want to split out `show version` and `show inventory`
183
182
 
184
183
  which will result in the following layout
185
184
 
186
- ```
185
+ ```text
187
186
  diff/$FQDN--show_running_config
188
187
  nodiff/$FQDN--show_version
189
188
  nodiff/$FQDN--show_inventory
190
- ```
189
+ ```
@@ -3,33 +3,39 @@
3
3
  The following objects exist in Oxidized.
4
4
 
5
5
  ## Input
6
- * gets config from nodes
7
- * must implement 'connect', 'get', 'cmd'
8
- * 'ssh', 'telnet, ftp, and tftp' implemented
6
+
7
+ * gets config from nodes
8
+ * must implement 'connect', 'get', 'cmd'
9
+ * 'ssh', 'telnet', 'ftp', and 'tftp' implemented
9
10
 
10
11
  ## Output
11
- * stores config
12
- * must implement 'store' (may implement 'fetch')
13
- * 'git' and 'file' (store as flat ascii) implemented
12
+
13
+ * stores config
14
+ * must implement 'store' (may implement 'fetch')
15
+ * 'git' and 'file' (store as flat ascii) implemented
14
16
 
15
17
  ## Source
16
- * gets list of nodes to poll
17
- * must implement 'load'
18
- * source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt'
19
- * name - name of the devices
20
- * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file)
21
- * input - method to acquire config, loaded dynamically as needed (Also default in config file)
22
- * output - method to store config, loaded dynamically as needed (Also default in config file)
23
- * prompt - prompt used for node (Also default in config file, can be specified in model too)
24
- * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
18
+
19
+ * gets list of nodes to poll
20
+ * must implement 'load'
21
+ * source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' for each device.
22
+ * `name` - name of the device
23
+ * `model` - model to use ('ios', 'junos', etc).The model is loaded dynamically by the first node of that model type. (Also default in config file)
24
+ * `input` - method to acquire config, loaded dynamically as needed (Also default in config file)
25
+ * `output` - method to store config, loaded dynamically as needed (Also default in config file)
26
+ * `prompt` - prompt used for node (Also default in config file, can be specified in model too)
27
+ * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
25
28
 
26
29
  ## Model
30
+
27
31
  ### At the top level
32
+
28
33
  A model may use several methods at the top level in the class. `cfg` is
29
34
  executed in input/output/source context. `cmd` is executed within an instance
30
35
  of the model.
31
36
 
32
37
  #### `cfg`
38
+
33
39
  `cfg` may be called with a list of methods (`:ssh`, `:telnet`) and a block with
34
40
  zero parameters. Calling `cfg` registers the given access methods and calling
35
41
  it at least once is required for a model to work.
@@ -38,6 +44,7 @@ The block may contain commands to change some behaviour for the given methods
38
44
  (e.g. calling `post_login` to disable the pager).
39
45
 
40
46
  #### `cmd`
47
+
41
48
  Is used to specify commands that should be executed on a model in order to
42
49
  gather its configuration. It can be called with:
43
50
 
@@ -69,18 +76,21 @@ Execution order is `:all`, `:secret`, and lastly the command specific block, if
69
76
  given.
70
77
 
71
78
  #### `comment`
79
+
72
80
  Called with a single string containing the string to prepend for comments in
73
81
  emitted configuration for this model.
74
82
 
75
83
  If not specified the default of `'# '` will be used (note the trailing space).
76
84
 
77
85
  #### `prompt`
86
+
78
87
  Is called with a regular expression that is used to detect when command output
79
88
  ends after a command has been executed.
80
89
 
81
90
  If not specified, a default of `/^([\w.@-]+[#>]\s?)$/` is used.
82
91
 
83
92
  #### `expect`
93
+
84
94
  Called with a regular expression and a block. The block takes two parameters:
85
95
  the regular expression, and the data containing the match.
86
96
 
@@ -90,26 +100,36 @@ The passed data is replaced by the return value of the block.
90
100
  it's further processed.
91
101
 
92
102
  ### At the second level
103
+
93
104
  The following methods are available:
94
105
 
95
106
  #### `comment`
107
+
96
108
  Used inside `cmd` invocations. Comments out every line in the passed string and
97
109
  returns the result.
98
110
 
99
111
  #### `password`
112
+
100
113
  Used inside `cfg` invocations to specify the regular expression used to detect
101
114
  the password prompt. If not specified, the default of `/^Password/` is used.
102
115
 
103
116
  #### `post_login`
117
+
104
118
  Used inside `cfg` invocations to specify commands to run once Oxidized has
105
- logged in to the switch. Takes one argument that is either a block (taking zero
119
+ logged in to the device. Takes one argument that is either a block (taking zero
106
120
  parameters) or a string containing a command to execute.
107
121
 
122
+ This allows `post_login` to be used for any model-specific items prior to running the regular commands. This could include disabling the output pager or timestamp outputs that would cause constant differences.
123
+
108
124
  #### `pre_logout`
125
+
109
126
  Used to specify commands to run before Oxidized closes the connection to the
110
- switch. Takes one argument that is either a block (taking zero parameters) or a
127
+ device. Takes one argument that is either a block (taking zero parameters) or a
111
128
  string containing a command to execute.
112
129
 
130
+ This allows `pre_logout` to be used to 'undo' any changes that may have been needed via `post_login` (restore pager output, etc.)
131
+
113
132
  #### `send`
133
+
114
134
  Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`.
115
- Takes a single parameter: a string to be sent to the switch.
135
+ Takes a single parameter: a string to be sent to the device.