oxidized 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08d1ddb80997414fda90c9aaa4c1cda7d572b092
4
- data.tar.gz: 2f11578926ac497672dda0293231b53e90bf3f6e
3
+ metadata.gz: ef4f4fdf11db316eef81011b12feafa631253ba4
4
+ data.tar.gz: 00cfa0009ac24aee8103c30a5958ddcf1164c2ea
5
5
  SHA512:
6
- metadata.gz: 59f6306c9dd3e6d586ed21340f1844647d343692e00a6a17a5f841d1254ba26643b2747f1c66599cd567d8b03e3f44c2689aabca705be000f0d93f82c99b8546
7
- data.tar.gz: 2352a0a428db0b54f971adf502c640142aed75b48bd0199fb380f2507bf49fb2d95cc13aeffd03db2c6d6f5760b5461fc9e222a28fc7b0f52ffdc3704d85c4b1
6
+ metadata.gz: 4b55a6e73224b1cf47defa5f2294b333f9cdfc20fa89aa74ef419ac10f6fbfb3d72e15bf65b3018e718daff1c4cbbddf0bfe5af071a0ffd6f305b76cef0e5527
7
+ data.tar.gz: bdddd0238c911027b927a510269bcf7d34d36e6f58c8df669531ee65ae765f057279e0bfbe26eefb2401f8ecad79cfae52c69d84376b0722fb272aed43b694d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.7.0
2
+ - FEATURE: support http source (by @laf)
3
+ - FEATURE: support Palo Alto PANOS (by @rixxxx)
4
+ - BUGFIX: screenos fixes (by @rixxxx)
5
+ - BUGFIX: allow 'none' auth in ssh (spotted by @SaldoorMike, needed by ciscosmb+aireos)
6
+
1
7
  # 0.6.0
2
8
  - FEATURE: support cumulus linux (by @FlorianDoublet)
3
9
  - FEATURE: support HP Comware SMB siwtches (by @sid3windr)
data/README.md CHANGED
@@ -27,6 +27,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacment
27
27
  * [Privileged mode](#privileged-mode)
28
28
  * [Source: CSV](#source-csv)
29
29
  * [Source: SQLite](#source-sqlite)
30
+ * [Source: HTTP](#source-http)
30
31
  * [Output: GIT](#output-git)
31
32
  * [Output: File](#output-file)
32
33
  * [Advanced Configuration](#advanced-configuration)
@@ -67,6 +68,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacment
67
68
  * Juniper ScreenOS (Netscreen)
68
69
  * Mikrotik RouterOS
69
70
  * Ubiquiti AirOS
71
+ * Palo Alto PAN-OS
70
72
 
71
73
 
72
74
  # Installation
@@ -99,7 +101,7 @@ To initialize a default configuration in your home directory ```~/.config/oxidiz
99
101
 
100
102
  ## Source
101
103
 
102
- Oxidized supports ```CSV``` and ```SQLite``` as source backends. The CSV backend reads nodes from a rancid compatible router.db file. The SQLite backend will fire queries against a database and map certain fields to model items. Take a look at the [Cookbook](#cookbook) for more details.
104
+ Oxidized supports ```CSV```, ```SQLite``` and ```HTTP``` as source backends. The CSV backend reads nodes from a rancid compatible router.db file. The SQLite backend will fire queries against a database and map certain fields to model items. The HTTP backend will fire queries against a http/https url. Take a look at the [Cookbook](#cookbook) for more details.
103
105
 
104
106
  ## Outputs
105
107
 
@@ -113,7 +115,7 @@ mkdir ~/.config/oxidized/configs
113
115
  oxidized
114
116
  ```
115
117
 
116
- Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CVS source add the following snippet:
118
+ Now tell Oxidized where it finds a list of network devices to backup configuration from. You can either use CSV or SQLite as source. To create a CSV source add the following snippet:
117
119
 
118
120
  ```
119
121
  source:
@@ -220,6 +222,28 @@ source:
220
222
  enable: enable
221
223
  ```
222
224
 
225
+ ### Source: HTTP
226
+
227
+ One object per device.
228
+
229
+ ```
230
+ source:
231
+ default: http
232
+ http:
233
+ url: https://url/api
234
+ scheme: https
235
+ delimiter: !ruby/regexp /:/
236
+ map:
237
+ name: hostname
238
+ model: os
239
+ username: username
240
+ password: password
241
+ vars_map:
242
+ enable: enable
243
+ headers:
244
+ X-Auth-Token: 'somerandomstring'
245
+ ```
246
+
223
247
  ### Output: File
224
248
 
225
249
  Parent directory needs to be created manually, one file per device, with most recent running config.
@@ -313,7 +337,7 @@ The following objects exist in Oxidized.
313
337
  * input - method to acquire config, loaded dynamically as needed (Also default in config file)
314
338
  * output - method to store config, loaded dynamically as needed (Also default in config file)
315
339
  * prompt - prompt used for node (Also default in config file, can be specified in model too)
316
- * 'sql' and 'csv' (supports any format with single entry per line, like router.db)
340
+ * 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
317
341
 
318
342
  ## Model
319
343
  * lists commands to gather from given device model
@@ -24,7 +24,7 @@ module Oxidized
24
24
  @ssh = Net::SSH.start @node.ip, @node.auth[:username],
25
25
  :password => @node.auth[:password], :timeout => CFG.timeout,
26
26
  :paranoid => secure,
27
- :auth_methods => %w(publickey password),
27
+ :auth_methods => %w(none publickey password),
28
28
  :number_of_password_prompts => 0
29
29
  unless @exec
30
30
  shell_open @ssh
@@ -0,0 +1,26 @@
1
+ class PanOS < Oxidized::Model
2
+
3
+ # PaloAlto PAN-OS model #
4
+
5
+ comment '! '
6
+
7
+ prompt /^[\w.\@:\(\)-]+>\s?$/
8
+
9
+ cmd :all do |cfg|
10
+ cfg.each_line.to_a[2..-3].join
11
+ end
12
+
13
+ cmd 'show system info' do |cfg|
14
+ cfg.gsub! /^(up)?time:\ .*\n/, ''
15
+ comment cfg
16
+ end
17
+
18
+ cmd 'show config running' do |cfg|
19
+ cfg
20
+ end
21
+
22
+ cfg :ssh do
23
+ post_login 'set cli pager off'
24
+ pre_logout 'exit'
25
+ end
26
+ end
@@ -18,6 +18,8 @@ class ScreenOS < Oxidized::Model
18
18
  end
19
19
 
20
20
  cmd 'get system' do |cfg|
21
+ cfg.gsub! /^Date\ .*\n/, ''
22
+ cfg.gsub! /^Up\ .*\n/, ''
21
23
  comment cfg
22
24
  end
23
25
 
@@ -0,0 +1,54 @@
1
+ module Oxidized
2
+ class HTTP < Source
3
+ def initialize
4
+ @cfg = CFG.source.http
5
+ super
6
+ end
7
+
8
+ def setup
9
+ if @cfg.url.empty?
10
+ raise NoConfig, 'no source http url config, edit ~/.config/oxidized/config'
11
+ end
12
+ end
13
+
14
+ require "net/http"
15
+ require "uri"
16
+ require "json"
17
+
18
+ def load
19
+ nodes = []
20
+ uri = URI.parse(@cfg.url)
21
+ http = Net::HTTP.new(uri.host, uri.port)
22
+ http.use_ssl = true if uri.scheme == 'https'
23
+
24
+ # map headers
25
+ headers = {}
26
+ @cfg.headers.each do |header, value|
27
+ headers[header] = value
28
+ end
29
+
30
+ request = Net::HTTP::Get.new(uri.request_uri, headers)
31
+
32
+ response = http.request(request)
33
+ data = JSON.parse(response.body)
34
+ data.each do |line|
35
+ next if line.empty?
36
+ # map node parameters
37
+ keys = {}
38
+ @cfg.map.each do |key, position|
39
+ keys[key.to_sym] = line[position]
40
+ end
41
+ keys[:model] = map_model keys[:model] if keys.key? :model
42
+
43
+ # map node specific vars, empty value is considered as nil
44
+ vars = {}
45
+ @cfg.vars_map.each { |key, position| vars[key.to_sym] = line[position].to_s.empty? ? nil : line[position] }
46
+ keys[:vars] = vars unless vars.empty?
47
+
48
+ nodes << keys
49
+ end
50
+ nodes
51
+ end
52
+
53
+ end
54
+ end
data/oxidized.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'oxidized'
3
- s.version = '0.6.0'
3
+ s.version = '0.7.0'
4
4
  s.licenses = %w( Apache-2.0 )
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez' ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxidized
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-22 00:00:00.000000000 Z
12
+ date: 2015-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asetus
@@ -130,6 +130,7 @@ files:
130
130
  - lib/oxidized/model/nos.rb
131
131
  - lib/oxidized/model/nxos.rb
132
132
  - lib/oxidized/model/outputs.rb
133
+ - lib/oxidized/model/panos.rb
133
134
  - lib/oxidized/model/powerconnect.rb
134
135
  - lib/oxidized/model/procurve.rb
135
136
  - lib/oxidized/model/routeros.rb
@@ -145,6 +146,7 @@ files:
145
146
  - lib/oxidized/output/git.rb
146
147
  - lib/oxidized/output/output.rb
147
148
  - lib/oxidized/source/csv.rb
149
+ - lib/oxidized/source/http.rb
148
150
  - lib/oxidized/source/source.rb
149
151
  - lib/oxidized/source/sql.rb
150
152
  - lib/oxidized/string.rb