oxidized 0.13.1 → 0.14.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: 3bbd5ac3977cc86ed65b0dfd7e7b07b4167ff6ea
4
- data.tar.gz: ba35ea479586e341df405b96f22e0f0df2a824f6
3
+ metadata.gz: 47e10a4f47bf206ef19e583804c53a8574c39119
4
+ data.tar.gz: 90c5644750d1498582834d7d26d75aedace6dcd8
5
5
  SHA512:
6
- metadata.gz: 74b2965664b512c425b7ca46b4016e7206fad7492e1b321decc5e50d1d87a77623d6d397a85c7033ab7f29a084807bf3eb8586fa2e04cd38f6c864f530c08cea
7
- data.tar.gz: 115db2427fb1be8d4871305ddbfae385c67ae31bd08a0ab3379fc70e033f1f1b675287747b9c0b13ce8629f5bbf4359acfd0b2cce6ad09d05e8a3022c678a9ae
6
+ metadata.gz: c002efeb2fb02a633bd8b47d602cd5a82d358bc66caf65606dca2ff91cd1add033e60b47d0838a97c95b55d714b9ff0db1a3b451affada1f50bca4f14754db8e
7
+ data.tar.gz: 22cf2eef018c432dc64bacecd018461ac65611d0d807b53f535e4254593a359d43d8a48f7563c8dedc45e516bdd30ea89e46330807a9184e194d4d30108d63ea
@@ -1,5 +1,12 @@
1
+ # 0 14.0
2
+ - FEATURE: support supermicro swithes (by @funzoneq)
3
+ - FEATURE: support catos switches
4
+ - BUGFIX: git+groups+singlerepo (by @PANZERBARON)
5
+ - BUGFIX: asa, tmos, ironware, ios-xr
6
+ - BUGFIX: mandate net-ssh 3.0.x, don't accept 3.1 (numerous issues)
7
+
1
8
  # 0.13.1
2
- - BUGFIX: file versions
9
+ - BUGFIX: file permissions (Sigh...)
3
10
 
4
11
  # 0.13.0
5
12
  - FEATURE: http post for configs (by @jgroom33)
data/README.md CHANGED
@@ -67,6 +67,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
67
67
  * Cisco
68
68
  * AireOS
69
69
  * ASA
70
+ * CatOS
70
71
  * IOS
71
72
  * IOSXR
72
73
  * NXOS
@@ -112,6 +113,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
112
113
  * Opengear
113
114
  * Palo Alto
114
115
  * PANOS
116
+ * Supermicro
117
+ * Supermicro
115
118
  * Ubiquiti
116
119
  * AirOS
117
120
  * Edgeos
@@ -125,7 +128,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
125
128
  Install all required packages and gems.
126
129
 
127
130
  ```shell
128
- apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake
131
+ apt-get install ruby ruby-dev libsqlite3-dev libssl-dev pkg-config cmake libssh2-1-dev
129
132
  gem install oxidized
130
133
  gem install oxidized-script oxidized-web # if you don't install oxidized-web, make sure you remove "rest" from your config
131
134
  ```
@@ -401,9 +404,23 @@ output:
401
404
  git:
402
405
  user: Oxidized
403
406
  email: o@example.com
404
- repo:
405
- first: "/var/lib/oxidized/first.git"
406
- second: "/var/lib/oxidized/second.git"
407
+ repo: "/var/lib/oxidized/git-repos/default.git"
408
+ ```
409
+
410
+ Oxidized will create a repository for each group in the same directory as the `default.git`. For
411
+ example:
412
+
413
+ ``` csv
414
+ host1:ios:first
415
+ host2:nxos:second
416
+ ```
417
+
418
+ This will generate the following repositories:
419
+
420
+ ``` bash
421
+ $ ls /var/lib/oxidized/git-repos
422
+
423
+ default.git first.git second.git
407
424
  ```
408
425
 
409
426
  If you would like to use groups and a single repository, you can force this with the `single_repo` config.
@@ -18,7 +18,7 @@ class ASA < Oxidized::Model
18
18
 
19
19
  cmd 'show version' do |cfg|
20
20
  # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
21
- cfg = cfg.each_line.select { |line| not line.match /\s+up\s+\d+\s+/ }
21
+ cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
22
22
  cfg = cfg.join
23
23
  comment cfg
24
24
  end
@@ -30,6 +30,22 @@ class ASA < Oxidized::Model
30
30
  cmd 'more system:running-config' do |cfg|
31
31
  cfg = cfg.each_line.to_a[3..-1].join
32
32
  cfg.gsub! /^: [^\n]*\n/, ''
33
+ # backup any xml referenced in the configuration.
34
+ anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
35
+ anyconnect_profiles.each do |profile|
36
+ cfg << (comment profile + "\n" )
37
+ cmd ("more" + profile) do |xml|
38
+ cfg << (comment xml)
39
+ end
40
+ end
41
+ # if DAP is enabled, also backup dap.xml
42
+ if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
43
+ cfg << (comment "disk0:/dap.xml\n")
44
+ cmd "more disk0:/dap.xml" do |xml|
45
+ cfg << (comment xml)
46
+ puts xml
47
+ end
48
+ end
33
49
  cfg
34
50
  end
35
51
 
@@ -0,0 +1,36 @@
1
+ class Catos < Oxidized::Model
2
+
3
+ prompt /^[\w.@-]+> \(enable\) $/
4
+ comment '# '
5
+
6
+ cmd :all do |cfg|
7
+ cfg.each_line.to_a[1..-2].join
8
+ end
9
+
10
+ cmd 'show system' do |cfg|
11
+ cfg = cfg.gsub /(\s+)\d+,\d+:\d+:\d+(\s+)/, '\1X\2'
12
+ comment cfg
13
+ end
14
+
15
+ cmd 'show version' do |cfg|
16
+ cfg = cfg.gsub /\d+(K)/, 'X\1'
17
+ cfg = cfg.gsub /^(Uptime is ).*/, '\1X'
18
+ comment cfg
19
+ end
20
+
21
+ cmd 'show conf all' do |cfg|
22
+ cfg = cfg.sub /^(#time: ).*/, '\1X'
23
+ cfg.each_line.drop_while { |line| not line.match /^begin/ }.join
24
+ end
25
+
26
+ cfg :telnet do
27
+ username /^Username: /
28
+ password /^Password:/
29
+ end
30
+
31
+ cfg :ssh, :telnet do
32
+ post_login 'set length 0'
33
+ pre_logout 'exit'
34
+ end
35
+
36
+ end
@@ -30,7 +30,7 @@ class IOSXR < Oxidized::Model
30
30
 
31
31
  cfg :telnet do
32
32
  username /^Username:/
33
- password /^Password:/
33
+ password /^\r?Password:/
34
34
  end
35
35
 
36
36
  cfg :telnet, :ssh do
@@ -23,6 +23,7 @@ class IronWare < Oxidized::Model
23
23
 
24
24
  cmd 'show version' do |cfg|
25
25
  cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' #remove unwanted line system uptime
26
+ cfg.gsub! /(^((.*)[Tt]he system started at(.*))$)/, ''
26
27
  cfg.gsub! /[Uu]p\s?[Tt]ime is .*/,''
27
28
 
28
29
  comment cfg
@@ -0,0 +1,45 @@
1
+ class Supermicro < Oxidized::Model
2
+ comment '! '
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
9
+
10
+ cmd :all do |cfg|
11
+ cfg.each_line.to_a[2..-2].join
12
+ end
13
+
14
+ cmd 'show running-config'
15
+
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
@@ -3,18 +3,20 @@ class TMOS < Oxidized::Model
3
3
  comment '# '
4
4
 
5
5
  cmd :secret do |cfg|
6
- cfg.gsub!(/password (\S+)/, 'password <secret removed>')
7
- cfg.gsub!(/passphrase (\S+)/, 'passphrase <secret removed>')
8
- cfg.gsub!(/community (\S+)/, 'community <secret removed>')
9
- cfg.gsub!(/community-name (\S+)/, 'community-name <secret removed>')
6
+ cfg.gsub!(/^([\s\t]*)secret \S+/, '\1secret <secret removed>')
7
+ cfg.gsub!(/^([\s\t]*\S*)password \S+/, '\1password <secret removed>')
8
+ cfg.gsub!(/^([\s\t]*\S*)passphrase \S+/, '\1passphrase <secret removed>')
9
+ cfg.gsub!(/community \S+/, 'community <secret removed>')
10
+ cfg.gsub!(/community-name \S+/, 'community-name <secret removed>')
11
+ cfg.gsub!(/^([\s\t]*\S*)encrypted \S+$/, '\1encrypted <secret removed>')
10
12
  cfg
11
13
  end
12
14
 
13
- cmd('tmsh show sys version') { |cfg| comment cfg }
15
+ cmd('tmsh -q show sys version') { |cfg| comment cfg }
14
16
 
15
- cmd('tmsh show sys software') { |cfg| comment cfg }
17
+ cmd('tmsh -q show sys software') { |cfg| comment cfg }
16
18
 
17
- cmd 'tmsh show sys hardware field-fmt' do |cfg|
19
+ cmd 'tmsh -q show sys hardware field-fmt' do |cfg|
18
20
  cfg.gsub!(/fan-speed (\S+)/, '')
19
21
  cfg.gsub!(/temperature (\S+)/, '')
20
22
  comment cfg
@@ -70,7 +70,10 @@ class Git < Output
70
70
  def version node, group
71
71
  begin
72
72
  repo = @cfg.repo
73
- if group
73
+ path = node
74
+ if group and @cfg.single_repo?
75
+ path = "#{group}/#{node}"
76
+ elsif group
74
77
  repo = File.join File.dirname(repo), group + '.git'
75
78
  end
76
79
  repo = Rugged::Repository.new repo
@@ -80,7 +83,7 @@ class Git < Output
80
83
  i = -1
81
84
  tab = []
82
85
  walker.each do |commit|
83
- if commit.diff(paths: [node]).size > 0
86
+ if commit.diff(paths: [path]).size > 0
84
87
  hash = {}
85
88
  hash[:date] = commit.time.to_s
86
89
  hash[:oid] = commit.oid
@@ -100,7 +103,7 @@ class Git < Output
100
103
  def get_version node, group, oid
101
104
  begin
102
105
  repo = @cfg.repo
103
- if group && group != ''
106
+ if group && group != '' && !@cfg.single_repo?
104
107
  repo = File.join File.dirname(repo), group + '.git'
105
108
  end
106
109
  repo = Rugged::Repository.new repo
@@ -115,7 +118,7 @@ class Git < Output
115
118
  begin
116
119
  repo = @cfg.repo
117
120
  diff_commits = nil
118
- if group && group != ''
121
+ if group && group != '' && !@cfg.single_repo?
119
122
  repo = File.join File.dirname(repo), group + '.git'
120
123
  end
121
124
  repo = Rugged::Repository.new repo
@@ -1,3 +1,3 @@
1
1
  module Oxidized
2
- VERSION = '0.13.1'
2
+ VERSION = '0.14.0'
3
3
  end
@@ -21,11 +21,11 @@ Gem::Specification.new do |s|
21
21
  s.required_ruby_version = '>= 2.0.0'
22
22
  s.add_runtime_dependency 'asetus', '~> 0.1'
23
23
  s.add_runtime_dependency 'slop', '~> 3.5'
24
- s.add_runtime_dependency 'net-ssh', '~> 3.0', '>= 3.0.2'
25
- s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4'
26
- s.add_development_dependency 'pry', '~> 0'
27
- s.add_development_dependency 'bundler', '~> 1.10'
28
- s.add_development_dependency 'rake', '~> 10.0'
24
+ s.add_runtime_dependency 'net-ssh', '>= 3.0.0', '<3.1'
25
+ s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4'
26
+ s.add_development_dependency 'pry', '~> 0'
27
+ s.add_development_dependency 'bundler', '~> 1.10'
28
+ s.add_development_dependency 'rake', '~> 10.0'
29
29
  s.add_development_dependency 'minitest', '~> 5.8'
30
- s.add_development_dependency 'mocha', '~> 1.1'
30
+ s.add_development_dependency 'mocha', '~> 1.1'
31
31
  end
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.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saku Ytti
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-30 00:00:00.000000000 Z
13
+ date: 2016-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: asetus
@@ -44,22 +44,22 @@ dependencies:
44
44
  name: net-ssh
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '3.0'
50
47
  - - ">="
51
48
  - !ruby/object:Gem::Version
52
- version: 3.0.2
49
+ version: 3.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.1'
53
53
  type: :runtime
54
54
  prerelease: false
55
55
  version_requirements: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.0'
60
57
  - - ">="
61
58
  - !ruby/object:Gem::Version
62
- version: 3.0.2
59
+ version: 3.0.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.1'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: rugged
65
65
  requirement: !ruby/object:Gem::Requirement
@@ -207,6 +207,7 @@ files:
207
207
  - lib/oxidized/model/aosw.rb
208
208
  - lib/oxidized/model/asa.rb
209
209
  - lib/oxidized/model/c4cmts.rb
210
+ - lib/oxidized/model/catos.rb
210
211
  - lib/oxidized/model/ciscosmb.rb
211
212
  - lib/oxidized/model/comware.rb
212
213
  - lib/oxidized/model/cumulus.rb
@@ -239,6 +240,7 @@ files:
239
240
  - lib/oxidized/model/routeros.rb
240
241
  - lib/oxidized/model/saos.rb
241
242
  - lib/oxidized/model/screenos.rb
243
+ - lib/oxidized/model/supermicro.rb
242
244
  - lib/oxidized/model/timos.rb
243
245
  - lib/oxidized/model/tmos.rb
244
246
  - lib/oxidized/model/vrp.rb